Translate

Home > February 2017

February 2017

Javascript Get ASP.NET Application hosting main path

Tuesday, February 21, 2017 Category : 0

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('/') + "/" %>';

Powered by Blogger.