Url Rebasing in ASP.NET 2.0
page 1 of 3
Published: 12 Jun 2009
Unedited - Community Contributed
In Asp.Net 2.0 masterpages are introduced to help develop websites with standardized and consistent design across all pages. The introduction of masterpages has enabled a new concept called URL rebasing. This article explains URL rebasing and its connection with masterpages. This article also clarifies what the purpose of URL rebasing is and the reason for its emergence. Finally, the article lists some interesting points about URL rebasing.
by Suresh Kumar Goudampally
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 22430/ 34


In ASP.NET 2.0 masterpages are introduced to develop the websites with standardized or consistent design across all pages.

The introduction of masterpages has embarked a new concept called Url Rebasing in ASP.NET 2.0. This article mainly explains what is Url Rebasing and its connection with masterpages. This article also clarifies what is purpose of Url Rebasing and reason for its emerging and also lists some interesting points about Url Rebasing.


Let’s say we have an image control with relative path on the masterpage html, and Masterpage is in one folder and the content page is in different folder. The relative image path given in the masterpage html markup points to the wrong location and the image is not rendered. To avoid these sorts of problems Asp.Net rebases relative urls known as Url Rebasing.

View Entire Article

User Comments

Title: A very apt and to-the-point article for the topic   
Name: Hardik Shah [Guru]
Date: 2010-03-14 4:50:27 AM
Good one ... !!! It surely sufficed.
Title: Resolve URL page method ?   
Name: Umar
Date: 2009-08-04 10:12:33 AM
They way you handle the URL issues is good but its old style that was adopted in 1.1 or before it. Now we have a page method "ResolveURL" which converts the relative path to absolute path.
Title: Good Practice   
Name: TrongKha
Date: 2009-07-31 6:03:36 PM
This is the good practice to solve link resource issues when you develop an ASP.NET application. You will not run into any problem even you decide to move (*.aspx) to different subfolders.

basePath = Request.ApplicationPath;
basePath = Page.ResolveUrl("/~");

(*.aspx) uses "~/folder/filename" for:
head runat="server"
asp:image ...
asp:hyperlink ...
Title: Mr   
Name: Thanigainathan
Date: 2009-07-31 8:36:45 AM
Very nice article. Will be helpful in practical scenarios.

Title: stylesheet trick   
Name: shaun
Date: 2009-07-30 4:45:47 AM
the trick to rebase the stylsheet is totally unneccessary.
the 'HEAD' section of the masterpage should have the 'runat=server' attribute and anything in the head section will be processed at the server, so just use the '~' in the stylesheet path to denote the root of your site.
Title: good one   
Name: vinny
Date: 2009-07-13 11:40:47 AM
Thank you Suresh
Title: Programmer   
Name: Cyril Gupta
Date: 2009-06-13 8:27:00 PM
Well, I simply use the '~' facility in my projects and though I don't identify it as rebasing or anything similar, it works wonderfully. Thanks for the article.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-07-25 11:54:57 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search