ONYX
ONYX

Reputation: 5859

ApplicationPath on Application_Start

I've been trying to get the application path for my project on the Application_Start event in the global asax I can use server.mappath on pages that aren't routed but when i am on a routed page i get the new virtual path is there a way of getting the application path on startup i can't use Request or session or HttpContext.items[key] at that level does anyone know what to do

Upvotes: 6

Views: 4049

Answers (2)

Imran Rizvi
Imran Rizvi

Reputation: 7438

Why don't you use Application_BeginRequest to map path everytime?

There you can use

HttpApplication.Request.RawUrl 

to get the requested path and later you can rewrite it with mapped path using

HttpContext.Current.RewritePath

Upvotes: -1

Related Questions