Search This Blog

Sunday, February 28, 2010

Path to current website directory in ASP.NET

I'm working on a standard name/address web app for permitting users to update their personal information.

The client wants to provide forced-choice options for certain fields in the active directory user object. He gave me some Excel files that I changed to XML files which the dropdown controls on the web form access. For example, he wants people to choose their "Department" field from a fixed list. Simple enough.

To improve the look/feel of the app I needed to have the webpage code to actually read that XML file to do a lookahead and pre-load a dropdown list position, but it was difficult to tell the codebehind code where exactly to look.

The solution was to preface the name of the XML file that I needed to read with the value "Request.PhysicalApplicationPath" -- that points it directly into the directory on the web server.

Monday, February 22, 2010

"An Exchange 2007 Server on which an address list service is active cannot be found" error

Another note to myself ...

This error means that the "Microsoft Exchange System Attendant" service on the Exchange 2007 server has stopped. Restart it and that should solve that particular problem.

Setup project always fails on build in VS2008

When setting up a setup project for a .NET 2.0 windows service in Visual Studio 2008 I ran into a novel problem this morning -- the setup project itself would always fail to build but wouldn't leave any error messages behind.

A Google search turned up a recent complaint about this in StackOverflow (http://stackoverflow.com/questions/847893/visual-studio-setup-and-deployment-build-fails-with-no-errors) but it wasn't exactly on target.

It provided enough clues to give me a workaround -- it seems to be related to the LINQ to SQL add-ins when making the setup project. The temporary answer was to create a new setup project, explicitly making it a .NET 2.0 project, and then try the build.

This made it work fine.

It'd be interesting to try and find a good solution for the problem but this works for now.

Monday, February 15, 2010

Getting JQuery Intellisense working in Visual Studio 2008

People have been using JQuery in Visual Studio successfully for over a year and there are a lot of links on how to set it up, but I thought I'd write myself a few notes on how to do it since I'm finding myself doing it on various machines (work desktop, home desktop, netbook, etc.) over time and need a quick cheat sheet.

1) Get the latest version of jquery from JQuery at http://docs.jquery.com/Downloading_jQuery. As of this writing it's version 1.4.1. Download the "jquery-1.4.1.js" file (the uncompressed version) and the related Visual Studio documentation file, "jquery-1.4.1-vsdoc.js."

2) Make sure you've got SP1 installed on Visual Studio 2008. You can check to see if it's installed by going to the "Help" tab and then the properties menu to check if the service pack has been installed:



















If it isn't installed, you can get it here: http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5-4c67-bd99-84e525b5ce61&displaylang=en

Note on installing the service pack: Be prepared to give it like 40+ minutes to run, plus have your Visual Studio 2008 release DVD around (or have the install files available somewhere on the hard disk) since it'll be asking for it during the upgrade.

3) Download the hotfix from Microsoft to support Jquery Intellisense:
http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736

4) Test it out with a small JQuery project. Create an ASP.NET web project, then add a "scripts" folder to the project and copy both the JQuery files downloaded earlier ("jquery-1.4.1.js" and "jquery-1.4.1-vsdoc.js") into it; add a "script" section to the ASP.NET markup of the page and add a reference to the JQuery file (see illustration) and type "$" to see if Intellisense is up and working -- :
















5) Typing a period after the dollar sign ("$.") should produce more JQuery Intellisense documentation and indicates that Intellisense and JQuery are now working together fine: