c# – HttpContext.Current.Request.ApplicationPath is empty on production

c# – HttpContext.Current.Request.ApplicationPath is empty on production

The ApplicationPath property returns the path to the folder where the application is, and it doesnt include the domain name.

I imagine that you have put the application in a folder with the same name as the domain name in your development server. The property then returns the name of the folder, not the actual domain.

pls try this

public static string RootURL {
get {
    var _with1 = System.Web.HttpContext.Current.Request;
    return _with1.Url.Scheme + :// + _with1.Url.Host + _with1.ApplicationPath;
}

}

use this function when you need root url with application path
please try and let me know if you have problem…….

c# – HttpContext.Current.Request.ApplicationPath is empty on production

Leave a Reply

Your email address will not be published.