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:-

http://msdn.microsoft.com/en-us/library/ms972974.aspx

http://www.nikhilk.net/Tag-Mapping-Form-URL-Rewriting.aspx

http://www.codeproject.com/KB/aspnet/SmartFormControl.aspx

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";

Cheers !!!