Web application absolute path

Wednesday, December 17th, 2008 | .NET

Just a reminder on how to get the absolute path for the webapplication in ASP.NET

HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) +        VirtualPathUtility.ToAbsolute(HttpContext.Current.Request.ApplicationPath)

This will return http://subdomain.domain.com/applicationname

You can drop those AppSettings with ApplicationPath :)

Tags:

No comments yet.

Leave a comment

Search

Knut Hamang

This is the official site for Knut Hamang. I am a professional technical consultant specialized in Microsoft and .NET technologies and platforms. I work as an independent consultant in Norway and have more than 10 years of professional experience. To get in contact with me, please send me an email or check my public profile on View Knut Hamang's profile on LinkedIn