Expression Web and the ASP.NET Web Admin Tool

Expression Web and the ASP.NET Web Admin Tool

 

A lot of web designers have asked about the ASP.NET Web Site Administration tool and how to use it when designing websites in Expression Web 1.0. So I decided a quick blog might be beneficial going forward. Hope this helps out everyone and if you have updates do not hesitate to send them my way. For those who have not heard of the ASP.NET Web Admin Tool, it is a nice configuration utility for setting up ASP.NET Membership, Web Protection.and Server settings (just to name a few). Here is a great link of full details to the ASP.NET Web Administration tool.

 

Currently Expression Web does not load up the Web Admin tool, we all see this type of experience when we try:

The first thing to do to get this going is to fire up Expression Web and create a web site, I'll use a file based directory, on my d: drive, and call it d:\casWeb

 

Now that I have a website on disk I can fire up the ASP.NET development server to be able to load the Web Admin Tool, I'll do this from the command line. Simply navigate to the directory on your hard disk where .NET 2.0 is installed, in my case this is: D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Advanced Note: You could just place this on your 'Windows Sytem Path' to simplify repetitive navigations to this directory in the future.

Once in the directory we'll need to start the ASP.NET web server with some special params for the Web Admin Tool (all one line):

WebDev.WebServer.EXE /port:8011 /path:"D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\asp.netwebadminfiles" /vpath:"/asp.netwebadminfiles"

Note: for path replace my D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 with the location of your Windows and .NET install

Advanced Note: For detailed understanding (if interested) on the params simply type in WebDev.WebServer.EXE and hit enter, you'll get this:

 

You should now see a nice little icon in your task bar:

OK - so now we have the ASP.NET Development server fired up and ready to configure ASP.NET websites. The next step is to load a URL against that port\webserver with some specific queryString values which target your website you created in Expression Web. To do this launch your web browser and paste or type this URL (note: you need to replace the d:\casweb with the path to the folder to your website):

https://localhost:8011/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=d:\casweb\&applicationUrl=/casweb

You'll now see the Web Site Administration Tool load up in your browser:

Since we targeted the Web Admin tool against our website (via the query string: ?applicationPhysicalPath=d:\casweb\&applicationUrl=/casweb) we can use the features of the Web Admin Tool and see that indeed we are working with the website we created in Expression Web. To test this click the Application Tab in your browser,

then click Configure SMTP e-mail Settings

Then just fill out any old text in the server name and from field (note: these are just values testing that we are indeed hooked up to the right web site, so just enter anything).

 

Click Save

Now let's head back to Expression Web and refresh the Folder List task pane, just click inside the task pane and press F5. You'll see a web.config file that the ASP.NET Web Administration Tool created for you:

Open the web.config file and you'll see the values you entered within the tool.

So longer term I'd like to find some more time for this topic and see about writing a plug in for Expression Web that handles a bit of this for you automagically, maybe I can talk some of you Expression fans out there in the ether to help me out? :)

For the brave at heart I did manage to get the following Macro working to do all of the tasks noted above, I tested this on Vista only so let me know what people run into. Also 64Bit is not tested and you do need to close the Web Server down (sorry my VBA is rusty!)...I'll create a quick blog next week for how to hook it up in Expression Web, but basically you need to create a macro by choosing Tools-Macro-Visual Basic Editor and paste the following in:

 

 Sub foo()
    Dim RetVal As Variant
    RetVal = VBA.Shell(System.ProfileString("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0", "Path") & "\WebDev.WebServer.EXE /port:8011 /path:""" & System.ProfileString("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0", "Path") & "\asp.netwebadminfiles"" /vpath:""/asp.netwebadminfiles""", vbHide)
    Value = System.ProfileString("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\iexplore.exe\shell\open\command", "")
    totalLength = Len(Value) - 3
    RetVal = VBA.Shell(Mid(Value, 1, totalLength) + " https://localhost:8011/asp.netwebadminfiles/default.aspx?applicationPhysicalPath=" & Mid(ParseURL(ActiveWebWindow.Web.Url, URLComponentServer), 4) + ParseURL(ActiveWebWindow.Web.Url, URLComponentPath) & ParseURL(ActiveWebWindow.Web.Url, URLComponentFileName) & "\&applicationUrl=" & "/" & ParseURL(ActiveWebWindow.Web.Url, URLComponentFileName), vbNormalFocus)
End Sub

save, close and then go to Tools->Customize, click the Command Tab, then in the categories list select macros, then drag and drop the happy Face icon  somewhere in the app, I placed it right on the right of the menu bar.. next right click the happy face (with that dialog still up) and select Assign Macro. You should see the macro you created in the previous step listed. Select it, click OK and click close. Your happy face should now do all of the config goo mentioned above for free.

Thanks for reading and I hope this helps you all out a little as you design in Expression Web and author for ASP.NET!

JD