January 2007 - Posts

TiddlyWiki is a very interesting piece of software.  Roy fist told me about this powerful single page JavaScript, CSS and HTML based Wiki.  TiddlyWiki is self contained meaning it stores all its code and data without the need of an external system.  We have been experimenting with using TiddlyWiki as a help system for our Web Applications.  It seems like a very easy way to maintain documentation for rapidly changing application.  Since TiddlyWiki is self contained within a single HTML document it can easily be included within any ASP.NET Application or Service Layer.  An application within an application!

Hacking my work laptop seems to be a regular occurrence lately.  Like most enterprises ours applies active directory policies that affect our machines.  Some policies make testing beta versions and new releases of software ahead of the official rollouts difficult.

 

After logging into the corporate network, over VPN, I noticed my login scripts weren’t running like they usually do.  Normally, after a successful connection a message box displays a welcome message. 

 

Curiosity got the best of me so I ran the script manually and began debugging.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Option Explicit

Dim Shell, netSys



Set Shell = WScript.CreateObject("WScript.Shell")

Set netSys = WScript.CreateObject("WScript.Network")



Dim strUsrDomain

Dim oInfo, LDAPUsr



strUsrDomain=netSys.UserDomain



' Some machines have had problems accessing Active Directory information so these section

' captures any errors and stops the script if there are any

Set oInfo = CreateObject("ADSystemInfo")

If err.number <> 0 Then

shell.popup("Error creating oInfo object " & e.description)

WScript.quit(1)

End If

Set LDAPUsr = GetObject("LDAP://" & oInfo.UserName)

If err.number <> 0 Then

shell.popup("Error creating LDAPUsr object " & e.description)

WScript.quit(1)

End If
 

The script was failing while trying to get the username from the oInfo object (oInfo.Username line: 20).  I began wondering if the problem was a permissions issue.  To test my theory I set gave my network login read access to the following DLL’s:

 

AdsLocator.dll

Activeds.dll

 

Finally, I tried running the login script again and it work perfectly.

ASP.NET 2.0 introduced a new connection strings section to the web.config.  All connection strings can be centralized in this one section making tasks like connection string encryption easier.  Dave Strommer recently showed me how to remove the connection strings from the web.config and place the entire connection string section in another config file.  This connections.config is then referenced from within the web.config.  This is a nice technique when maintaining several applications that connect to the same databases.  A connections.config file can be versioned and then referenced by the application as basically a library or include.  See the code below as an example.

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings configSource="appSettings.config"/>
  <connectionStrings configSource="connections.config"/> 
   <system.web>
      <compilation debug="true" />
      <authentication mode="Windows"/>
      <identity impersonate="true"/>
   </system.web>
</configuration>

Editing the registry can be a time consuming process.  Sometimes updates or cleanups are easier to perform via a registry script (.reg).   A registry script can be created using note pad.  For a registry script to execute properly the first line needs to be either REGEDIT4 (Windows NT4, Windows 2000, Windows XP) or Windows Registry Editor Version 5.00 (Windows 2K and Windows XP).

So a script would look like:

REGEDIT4

[HKEY_CURRENT_USER\SomeKey]

"SomeValue" = "ON"