How to get the absolute uri of a relative uri?

Public static string ResolveUrl(string originalUrl) { if (originalUrl == null) return null; // *** Absolute path - just return if (originalUrl. IndexOf("://")! = -1) return originalUrl; // *** Fix up image path for ~ root app dir directory if (originalUrl.

StartsWith("~")) { string newUrl = ""; if (HttpContext. Current! = null) newUrl = HttpContext.Current.Request.

ApplicationPath + originalUrl. Substring(1). Replace("//", "/"); else // *** Not context: assume current directory is the base directory throw new ArgumentException("Invalid URL: Relative URL not allowed."); // *** Just to be sure fix up any double slashes return newUrl; } return originalUrl; } Taken from http://www.west-wind.com/weblog/posts/154812.aspx.

HttpContext.Current.Request. ApplicationPath only returns "/" so this approach doesn't work either. Any thought?

– Dynamic Apr 7 at 8:53.

I used this method: private static string GetAbsoluteUrl(string relativeUrl) { var applicationUrl = String. Empty; // remove ~ if (relativeUrl. StartsWith("~")) { applicationUrl = relativeUrl.

Substring(1); } applicationUrl = (HttpContext.Current.Request. ApplicationPath + applicationUrl) . Replace("//", "/"); var baseUrl = String.

Format("{0}://{1}:{2}", HttpContext.Current.Request.Url. Scheme, HttpContext.Current.Request.Url. Host, HttpContext.Current.Request.Url.

Port); return baseUrl + applicationUrl; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions