ApplicationPath on Application_Start

I am trying to get the application path to my project in the Application_Start event in the global asax. I can use server.mappath on pages that are not routed, but when I'm on a routed page, I get a new virtual path there is a way to get the application path at startup, I can not use Request or session or HttpContext.items [key] at this level anyone know what to do

+6
source share
2 answers

Why don't you use Application_BeginRequest to display the path every time?

There you can use

HttpApplication.Request.RawUrl 

to get the requested path, and then you can rewrite it using the mapped path using

 HttpContext.Current.RewritePath 
-1
source

Source: https://habr.com/ru/post/904595/


All Articles