why the below line has error in global.asax :
string RelativeFilePath = "~/" + (AbsoluteFilePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty)).Replace("\\", "/");
Error :
Request is not available in this context
what is the replacement?
thanks in advance
In IIS7 or greater, the Integrated pipeline was introduced, and some rules changed. You cannot access the current HttpContext in Application_Start. Here's more information.
To quote, here's your options:
Since you're just getting the application's physical path, I'd stick with Integrated Mode and just change your code.
If you are hosting your application in IIS7 integrated pipeline HttpContext objects are not available in
Application_Start
. For your scenario you could do this instead: