Jose Saiz

Jose Saiz

  • 1.5k
  • 260
  • 103.1k

ApplicationPath only works in IDE

Dec 26 2016 6:45 PM
Can anyone please tell me what am I missing here?
I have the following function
  1. public string GetHostedPageUrl(string pPageName)  
  2. {  
  3.     string _sHostedPageUrl = HttpContext.Current.Request.ApplicationPath.Trim();  
  4.         _sHostedPageUrl += HttpContext.Current.Request.PhysicalApplicationPath.Substring(ncGlobal.WebApplicationPath.Length).Replace('\\', '/').Insert(0, "/") + pPageName;  
  5.         return _sHostedPageUrl;    
  6. }  
 I use it on plain client-side html <a href="<%=GetHostedPageUrl("Home.aspx")%>">Home</a>
 
in the Visual Studio 2010 IDE works 100% fine, but once I publish-compile the project and deploy it does not work.
 
Any Idea
 
TIA 

Answers (2)