Not sure if this is IIS or ASP.NET

Not sure if this is IIS or ASP.NET

am 07.04.2008 03:42:44 von Sir Psycho

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?

Re: Not sure if this is IIS or ASP.NET

am 07.04.2008 09:16:43 von lexa

On Apr 7, 3:42=A0am, Vince wrote:
> 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 =3D
> 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 !=3D null && Request.Url !=3D null &&
Request.Url.AbsolutePath.Split(new char[] { '/' }).Length>1)
string appName =3D ...

Re: Not sure if this is IIS or ASP.NET

am 07.04.2008 16:22:12 von 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.


"Vince" wrote in message
news:b95b5cef-439d-4c35-8a42-f43f128613a2@k1g2000prb.googleg roups.com...
> 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?