Not sure if this is IIS or ASP.NET

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?
Sir Psycho [ Mo, 07 April 2008 03:42 ] [ ID #1936955 ]

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

On Apr 7, 3:42=A0am, Vince <panuccio.vi... [at] gmail.com> 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 ...
lexa [ Mo, 07 April 2008 09:16 ] [ ID #1936966 ]

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

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" <panuccio.vince [at] gmail.com> wrote in message
news:b95b5cef-439d-4c35-8a42-f43f128613a2 [at] 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?
George Ter-Saakov [ Mo, 07 April 2008 16:22 ] [ ID #1936972 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Not sure if this is IIS or ASP.NET

Vorheriges Thema: Error Code 80070545 when trying to run Web Service on another
Nächstes Thema: random content pages shown, but never both