By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

Anyone have experience w/ Application["AppState"]?

P: n/a
I stumbled across Application["AppState"] from someone else's code, and I can't
find out squat about by searching MS, Google, or Google Groups.

For the most part, this is returning the fully-qualified name of the server and
path to my application, such as:

http://devserver/testapp

However, on 1 of my test servers, it returns:

http://localhost/testapp

When browsing the app on the server, that isn't a problem, however if remotely
accessing it from another machine, it is still returning localhost. As
mentioned, the same application on 3 other servers behaves as expected where
the servername is appropriately substituted.

The only difference between the servers is the ones that work are running IIS 5
(XP), the one that doesn't is running IIS 4 (2k). Is there some difference
between these IIS versions that would somehow affect how Application["AppPath"]
is initialized?

Thanks
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
This is an application variable that is initialized and stored for later
reuse. If you start browsing from localhost, it will record this path and it
will then be incorrect for other users browsing from outside.
Try first to see if it's ok when the application is first accessed when not
using localhost...

It is likely initialized in the global.asax file.

"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
I stumbled across Application["AppState"] from someone else's code, and I can't find out squat about by searching MS, Google, or Google Groups.

For the most part, this is returning the fully-qualified name of the server and path to my application, such as:

http://devserver/testapp

However, on 1 of my test servers, it returns:

http://localhost/testapp

When browsing the app on the server, that isn't a problem, however if remotely accessing it from another machine, it is still returning localhost. As
mentioned, the same application on 3 other servers behaves as expected where the servername is appropriately substituted.

The only difference between the servers is the ones that work are running IIS 5 (XP), the one that doesn't is running IIS 4 (2k). Is there some difference between these IIS versions that would somehow affect how Application["AppPath"] is initialized?

Thanks

Nov 16 '05 #2

P: n/a
Patrice wrote:

This is an application variable that is initialized and stored for later
reuse. If you start browsing from localhost, it will record this path and it
will then be incorrect for other users browsing from outside.
Try first to see if it's ok when the application is first accessed when not
using localhost...

It is likely initialized in the global.asax file.
Ok, I'm making some progress. What I thought was a predefined value for
AppPath, turns out to be initialized elsewhere in the project (I had searched
the project for occurrences, but nothing showed up for this particular file).

Regardless, I've found the location of the problem, now I need to find a
solution (for the different versions of IIS?).

Thanks

"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
I stumbled across Application["AppState"] from someone else's code, and I

can't
find out squat about by searching MS, Google, or Google Groups.

For the most part, this is returning the fully-qualified name of the

server and
path to my application, such as:

http://devserver/testapp

However, on 1 of my test servers, it returns:

http://localhost/testapp

When browsing the app on the server, that isn't a problem, however if

remotely
accessing it from another machine, it is still returning localhost. As
mentioned, the same application on 3 other servers behaves as expected

where
the servername is appropriately substituted.

The only difference between the servers is the ones that work are running

IIS 5
(XP), the one that doesn't is running IIS 4 (2k). Is there some

difference
between these IIS versions that would somehow affect how

Application["AppPath"]
is initialized?

Thanks

Nov 16 '05 #3

P: n/a
The quicker fix I see would be to change every occurence of
Application["AppPath"] with the corresponding expression used for
initializing this variable (would avoid to have a unique value regardless of
the way the website is accessed).

From a general point of view, you may or may not need the full information.
Generally Request.ApplicationPath ( that returns the root of your
application such as "/testapp") should be enough (assuming you want to keep
the same hostname and the same protocol).

Patrice

"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
Patrice wrote:

This is an application variable that is initialized and stored for later
reuse. If you start browsing from localhost, it will record this path and it will then be incorrect for other users browsing from outside.
Try first to see if it's ok when the application is first accessed when not using localhost...

It is likely initialized in the global.asax file.
Ok, I'm making some progress. What I thought was a predefined value for
AppPath, turns out to be initialized elsewhere in the project (I had

searched the project for occurrences, but nothing showed up for this particular file).
Regardless, I've found the location of the problem, now I need to find a
solution (for the different versions of IIS?).

Thanks

"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
I stumbled across Application["AppState"] from someone else's code, and I
can't
find out squat about by searching MS, Google, or Google Groups.

For the most part, this is returning the fully-qualified name of the

server and
path to my application, such as:

http://devserver/testapp

However, on 1 of my test servers, it returns:

http://localhost/testapp

When browsing the app on the server, that isn't a problem, however if

remotely
accessing it from another machine, it is still returning localhost.
As mentioned, the same application on 3 other servers behaves as expected

where
the servername is appropriately substituted.

The only difference between the servers is the ones that work are

running IIS 5
(XP), the one that doesn't is running IIS 4 (2k). Is there some

difference
between these IIS versions that would somehow affect how

Application["AppPath"]
is initialized?

Thanks

Nov 16 '05 #4

P: n/a
Patrice wrote:

The quicker fix I see would be to change every occurence of
Application["AppPath"] with the corresponding expression used for
initializing this variable (would avoid to have a unique value regardless of
the way the website is accessed).

From a general point of view, you may or may not need the full information.
Generally Request.ApplicationPath ( that returns the root of your
application such as "/testapp") should be enough (assuming you want to keep
the same hostname and the same protocol).
Yes, good comments. The original intention by the original author (which I'm
not) was to provide a way in the ASPX pages to properly define paths (to images
in this case) regardless of where the page is located in the site hierarchy,
and regardless of where the site was originally installed in the web server
hierarchy.

The entire qualified name is _not_ needed, so I may be better off using the
Request.ApplicationPath as you point out.

Thanks again for your comments and suggestions.


"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
Patrice wrote:

This is an application variable that is initialized and stored for later
reuse. If you start browsing from localhost, it will record this path and it will then be incorrect for other users browsing from outside.
Try first to see if it's ok when the application is first accessed when not using localhost...

It is likely initialized in the global.asax file.


Ok, I'm making some progress. What I thought was a predefined value for
AppPath, turns out to be initialized elsewhere in the project (I had

searched
the project for occurrences, but nothing showed up for this particular

file).

Regardless, I've found the location of the problem, now I need to find a
solution (for the different versions of IIS?).

Thanks

"Julie" <ju***@nospam.com> a écrit dans le message de
news:40***************@nospam.com...
> I stumbled across Application["AppState"] from someone else's code, and I can't
> find out squat about by searching MS, Google, or Google Groups.
>
> For the most part, this is returning the fully-qualified name of the
server and
> path to my application, such as:
>
> http://devserver/testapp
>
> However, on 1 of my test servers, it returns:
>
> http://localhost/testapp
>
> When browsing the app on the server, that isn't a problem, however if
remotely
> accessing it from another machine, it is still returning localhost. As > mentioned, the same application on 3 other servers behaves as expected
where
> the servername is appropriately substituted.
>
> The only difference between the servers is the ones that work are running IIS 5
> (XP), the one that doesn't is running IIS 4 (2k). Is there some
difference
> between these IIS versions that would somehow affect how
Application["AppPath"]
> is initialized?
>
> Thanks

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.