Not sure if this is IIS or ASP.NET

V

Vince

Hi,

When connecting to my application via IIS v 5.1, my asp code is
failing in my application start of the global.asax.cs file

string appName =
HttpContext.Current.Request.Url.AbsolutePath.Split(new char[] { '/' })
[1].ToUpper();


Url is null for some reason and I have no idea why.

Im entering http://localhost/myapplication/logon/logon.aspx

It works when i run the project from visual studio in debug mode...IIS
though it doesnt.

Any ideas?
 
G

Guest

Hi,

When connecting to my application via IIS v 5.1, my asp code is
failing in my application start of the global.asax.cs file

string appName =
HttpContext.Current.Request.Url.AbsolutePath.Split(new char[] { '/' })
[1].ToUpper();

Url is null for some reason and I have no idea why.

Im enteringhttp://localhost/myapplication/logon/logon.aspx

It works when i run the project from visual studio in debug mode...IIS
though it doesnt.

Any ideas?

What method do you use in the global.asax? I think you also should
check Url before using it

if(Request != null && Request.Url != null &&
Request.Url.AbsolutePath.Split(new char[] { '/' }).Length>1)
string appName = ...
 
G

George Ter-Saakov

I think Response, Request, ... objects are not available in application
OnStart method
Theoretically it can be called without browser. When IIS restarts
application (for example if web.config was modified).
Not sure though....
But safe bet is not to count on that... Plus I have not seen a design where
you need Request/Response in Application_OnStart method...

George.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top