Wednesday

Code - Create an Absolute URL from and Application Relative URL


I don't like to talk for the sake of talking, so lets get down to the recipe, shall we?

public string GetAbsoluteURL(string relURL)
{
    return new Uri(Request.Url, ResolveUrl(relURL)).ToString();
}

Note: ResolveUrl is a method exposed from Page class in Asp.Net and is used to convert a Url into one which is usable on the requesting client.

No comments:

Post a Comment

Your comments are highly appreciated!