Friday, January 22, 2010

Root URL property for Asp.net Web Applications

public string RootUrl
{
    get
    {
        Uri requestUri = Context.Request.Url;
        HttpRequest request = Context.Request;
        string rootUrl = string.Format("{0}{1}{2}{3}{4}",
            requestUri.Scheme,
            Uri.SchemeDelimiter,
            requestUri.Host,
            requestUri.IsDefaultPort ? string.Empty : string.Format(":{0}", requestUri.Port),
            request.ApplicationPath);
        return rootUrl.EndsWith("/") ? rootUrl : string.Format("{0}/", rootUrl);
    }
}

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...