August 2008 Entries
Click here to see a Video version of this article
If you have worked with URL Rewriting in ASP.NET, you would have figured out that it is pretty difficult to sustain since the ASP.NET Form tag's Action attribute cannot be overridden or manually set until you do some plumbing work. In simple terms, you couldnt do a form1.Action = "Your Friendly URL" even though with URL mapping, the URL users see in the browser seems to be friendly. What is the issue with the Action tag would be your question? Well, there are couple of them. When you make a postback from your friendly URL say...(yoursite/products which actually points to yoursite/products.aspx or something similar to it), after postback, the friendly URL changes to yoursite/products.aspx (the URL contained in the form's action tag. Hence it kind of gives a discontinued structure for your website navigation.
Secondly, people complain about missing out on search engine rankings which, potentially can improve if there are more/friendly URLs as against a single URL with querystrings etc.,
While there are many work arounds, some of the significant ones below are:-
However, the good news is that, with .NET 3.5 SP1 this issue has been fixed and now, you can programmatically set the form's action tag to the desired friendly URL that you always wanted.
Note that this comes out only with .NET 3.5 SP1 and even if you are using Visual Studio 2008 and creating ASP.NET 3.5 websites, you cannot use this feature. Hence, one more reason to install .NET 3.5 SP1 and VS 2008 SP1
An example to make it simpler:-
Friendly URL : - www.yoursite.com/products
Actual URL: - www.yoursite.com/products.aspx
URL mapping in Web.Config:
<add url="~/Products" mappedUrl="~/Products.aspx"/>
Setting the Form's Action attribute in the code-behind:-
form1.Action = "Products";
If you have received the error "Unable to create the Website...To access local IIS Websites, you must run Visual Studio in the context of an administrator account.", you must be running Windows Vista and trying to create a website in the local IIS.
I have been encountering this error often although it is well documented (hard to find?) And time and again, I realize that I need to run Visual Studio under the admin priveleges by elevating it, to create website in the IIS. Hence thought of posting this.
In Windows Vista, by default the applications dont run under the admin priveleges even though you are logged in as an administrator.
To elevate the priveleges, you would require to find Visual Studio from the Start - All Programs - Menu, Right click on the Visual Studio icon and select "Run as administrator", Click "Continue" for the UAC prompt and thereafter you would be able to create websites in the local IIS.
Alternatively, you could also use the built-in cassini webserver to create/host the application in any folder and run it against the ASP.NET Development Server (notice the tiny icon that gets created in your systray) that gets created automatically for running/testing on local machines.
A nice shortcut has been posted by one of our MVPs at http://forums.msdn.microsoft.com/en-US/vsx/thread/501bb098-ccf0-4d6d-933d-dcde58d233e1/ which can be useful to avoid the above steps, everytime.
The much awaited Visual Studio 2008 SP1 and the .NET Framework 3.5 SP1 is now RTM !! While we have talked about the .NET 3.5 SP1 features for a long time now, the RTM release marks something special for Web Developers. You would be able to build and deploy real world applications and use some of the cool features like Dynamic Data.
Before installing Visual Studio 2008 SP1, it is recommended to run the Visual Studio 2008 Service Pack Preparation Tool. The tool can be downloaded from here This tool removes any earlier versions of the SP1 Beta and also prepares your system for installing the SP1.
What do I get installing this? Well, a whole bunch of stuff considering that this is just a Service Pack. Instead of me listing it down, there is a cool post by the Web Development Tools team that lists them over here
The Web Development Tools blog is one of the most important resources you need to follow. You can subscribe for the same at http://blogs.msdn.com/webdevtools/
Also, there is a new blog that is put up for Web Development Tips & Tricks. Check it out at http://blogs.msdn.com/webdevelopertips/
If you are like me and wanted a comparison on which edition of Windows Vista to buy, you could just visit the following Microsoft.com site http://www.microsoft.com/windows/windows-vista/compare-editions/default.aspx to get the best idea of the features you would like to have and decide accordingly.
Most of the editions today come with SP1. So, many of the compatibility issues with a lot of third party solutions have been fixed now.
The Windows Vista Ultimate, needless to say, is the best you could think of and if you are targetting Media Center, Collaboration etc., this is the one you should be going for.
Thought of posting this link since it took sometime for me to figure out even from the windows vista official website, this particular reference.