0

I need to get access to the AppFriendlyName of a IIS application in the global.asa Application_Start event (classic ASP)

I am looking for the equivalent of HttpContext.Current.Request.ApplicationPath in the global.asax (ASP.NET)

Is there a way to do that ?

Thanks for your help !

Jerome Wagner

Jerome WAGNER
  • 21,986
  • 8
  • 62
  • 77

1 Answers1

0

This is one way to do it..

path = Request.ServerVariables("URL")
position = InStr(2,path,"/",1)
Response.Write Right(Left(path,position-1),position-2) & "<br/>"

although it might not look good on the eyes ;)

UPDATE: Which of course doesn't work in Global.asa, since you can only use the Request object in Session_OnStart and Session_OnEnd. My bad, sorry.

Tchami
  • 4,647
  • 1
  • 32
  • 45
  • The "Request" object does not seem to be available in global.asa Application_Start event which makes it impossible to get the path. – Jerome WAGNER Aug 23 '10 at 09:45
  • You're right ofcourse. In that case I don't belive you can do it. Your best bet is to do it in the Session_OnStart event, write the result to an Application variable and then check that on every Session_OnStart event so you only do it once. – Tchami Aug 23 '10 at 10:18
  • yes of course. The problem is that i am constrained by a session-less configuration that cannot be changed ; If you add an answer saying that it is not possible by a pure application_start call i'll attribute you the correct answer. thx. – Jerome WAGNER Aug 23 '10 at 17:49