Javascript Get ASP.NET Application hosting main path
Posted on Tuesday, February 21, 2017
|
No Comments
Problem Arise when use to set image source using javascript , then after publish in IIS sub directory image is not loaded, for hosting directory miss match. then we can catch the hosting directory , and append to image source.
var dd = '<% =Request.ApplicationPath %>';
console.log(dd);
var _baseURL = '<%=Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" %>';