January 27, 2021
Hot Topics:

How to Implement and Utilize URL Rewriting with ASP.NET

  • By David Consdorf
  • Send Email »
  • More Articles »

3. Improve the security of your web site

URLs can contribute to security threats because they expose the inner workings of your web site.

For example, by using the ".aspx" prefix, you are exposing that you are using ASP.NET as opposed to some other framework such as JSP or PHP. This can give a potential hacker clues as to how to attack your site. URL rewriting can help by changing the prefix to something more generic like ".x" or ".mysite". This will help keep potential hackers guessing.

Another security concern is that displaying your site directory and URL parameters in a URL can give a hacker vital information for attempting front-end attacks. With this information, they can potentially figure out a security hole in your site by changing your parameters around or accessing parts of your web site they are not supposed to know about. URL rewriting can help by hiding vital URL parameters and changing your directory structure.

Also, note that as far as security is concerned, URL rewriting is only one part of a site's complete security package. Simply hiding security holes doesn't mean that they aren't there, so be sure to test your site's security thoroughly.

4. Improve the usability and professionalism of your site

Long non-user friendly URLs can be a usability issue. Users will not always link into your site from another link. Users manually type in the URL for sites more than you might think. If the users have to type in a long and/or messy URL, it may be a deterrent and some users will decide it is not worth it. Another thing to consider is the ease with which people can talk about your site. A long URL that is hard to say will not be communicated as readily as a concise and meaningful one. Long URLs also may cause problems when a user emails a friend your sites URL. Sometimes, long URLs can be difficult to fully highlight and they may not be copy/pasted in their entirety. If this is the case, the emailed link will not work and you may lose a potential user.

Whatever the case, it tends to be a good idea to keep URLs simple and concise. URL rewriting can help do this transparently without having to change the underlying directory structure and page names.

Nice-looking URLs can also add to a site's professionalism and overall look and feel. It also gives you a chance to show off that you know what you are doing. Nothing says hobbyist web site like a messy URL structure.


The methods and ideas discussed here are only part of a complete solution to a great web site, but I hope this article has given you a comprehensive look into how and why URL rewriting can be used to enhance your web site. There are many things to take into consideration when building the perfect web site and URL rewriting is a good tool to have in your arsenal. With a solid plan and hard work you will find success. Happy coding!

Code Examples

To download the example code in this article, click here: Download Code Examples.

About the Author

David Consdorf graduated with a Bachelor's Degree in Computer Science from the University of Illinois Urbana-Champaign and now resides in Chicago, Illinois. For the last three years, he has been developing ASP.NET web applications as a software consultant for Crowe Chizek and Company LLC. Crowe Chizek and Company LLC is a Microsoft Gold Certified Partner.

Page 4 of 4

This article was originally published on October 8, 2007

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date