Url Rebasing in ASP.NET 2.0
page 3 of 3
by Suresh Kumar Goudampally
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 22760/ 41

Conclusion

This article mainly describes the newly emerged concept Url Rebasing in ASP.NET 2.0, and what is relative path and its impact when used in masterpage. This article also quotes some examples to explain the real time issues and how URL rebasing resolves this loophole we face using relative paths in masterpages. We have also summarized Url Rebasing tips in a nut shell.

References

http://www.odetocode.com/Articles/419.aspx

http://aspnetresources.com/blog/more_on_url_rebasing_in_master_pages.aspx

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

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/masterpages/default.aspx#urls


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
Comment:
Good one ... !!! It surely sufficed.
Title: Resolve URL page method ?   
Name: Umar
Date: 2009-08-04 10:12:33 AM
Comment:
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
Comment:
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;
or
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
Comment:
Very nice article. Will be helpful in practical scenarios.

Thanks,
Thani
Title: stylesheet trick   
Name: shaun
Date: 2009-07-30 4:45:47 AM
Comment:
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
Comment:
Thank you Suresh
Title: Programmer   
Name: Cyril Gupta
Date: 2009-06-13 8:27:00 PM
Comment:
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-04-26 7:36:14 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search