Showing posts with label running. Show all posts
Showing posts with label running. Show all posts

Saturday, March 31, 2012

Session URL Formatting

Hello,

I have a problem with ASP.Net:

I have an ASP.Net application on a web farm, using SQL Server Session
State Management, running on Windows 2000 (IIS 5)
With session management on, a URL like the following is created:
https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
The problem I am having is that at some point within the web application
I have to pass this link to an outside server, which in turn,
will do some work and then post back to my application. However, the
outside application is URL Encoding my URL, which in turn,
causes the URL to look like:
mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
This cannot be handled by IIS, and induces a "page cannot be displayed
error"; which in effect, causes the application to terminate.

Is there any way that we can trap this error and redirect to the appropriate
location so that the web application does terminate, or is there a way
we can prevent the brackets within this application.

Hope I explained this correctly.

Appreciate any help.

Regards,

Malcolm KlotzOne approach - not clean - you can catch the IIS error code 404 and then
handle the issue on a redirect page. Sorry, I can't think of anything
cleaner at the moment.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Malcolm Klotz" <nonesuch23@.online.nospam> wrote in message
news:OvlaLxATFHA.2812@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I have a problem with ASP.Net:
> I have an ASP.Net application on a web farm, using SQL Server Session
> State Management, running on Windows 2000 (IIS 5)
> With session management on, a URL like the following is created:
> https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
> The problem I am having is that at some point within the web
> application
> I have to pass this link to an outside server, which in turn,
> will do some work and then post back to my application. However, the
> outside application is URL Encoding my URL, which in turn,
> causes the URL to look like:
> mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
> This cannot be handled by IIS, and induces a "page cannot be displayed
> error"; which in effect, causes the application to terminate.
> Is there any way that we can trap this error and redirect to the
> appropriate
> location so that the web application does terminate, or is there a way
> we can prevent the brackets within this application.
> Hope I explained this correctly.
> Appreciate any help.
> Regards,
> Malcolm Klotz
Thanks for Alvin's inputs,

Hi Malcolm,

Since you are using the cookieless Session(embed sessionid in the url
string) in your web app, is there any particular requirement in your
scenario that we must use cookieless session? Is it possbile that we use
cookieenabled session instread?

Also, as for passing the url to a outside server, I think we have the
following means:

1. If we are forced to use cookieless session and with the sessionid
embeded in the url, I suggest that we filter the sessionid when pass the
url out to the remote server. For example:

when giving the following url

https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx

we can use substring concating or regex to get the url without embeded
sessionid like:

https://mywebapp.com/start.aspx

this can also work for the remote requster, the only difference is that the
request with non-sessionid url will be unable to retrieve the data in the
SessionState associated with the id. Do you think this means possbile?

2. If we also want to let the remote server be able to retrieve the
sessiondata, I suggest that we still pass the urlstring without embeded
sessionid , but also pass the SessionId string as separate data to that
remote server together with the url string. How do you think of this?

Please feel free to post here if you have any other questions or ideas.
Thanks,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thank you, you have given me a place to start.

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:eSJz3kGTFHA.2476@.TK2MSFTNGXA01.phx.gbl...
> Thanks for Alvin's inputs,
> Hi Malcolm,
> Since you are using the cookieless Session(embed sessionid in the url
> string) in your web app, is there any particular requirement in your
> scenario that we must use cookieless session? Is it possbile that we use
> cookieenabled session instread?
> Also, as for passing the url to a outside server, I think we have the
> following means:
> 1. If we are forced to use cookieless session and with the sessionid
> embeded in the url, I suggest that we filter the sessionid when pass the
> url out to the remote server. For example:
> when giving the following url
> https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
> we can use substring concating or regex to get the url without embeded
> sessionid like:
> https://mywebapp.com/start.aspx
> this can also work for the remote requster, the only difference is that
the
> request with non-sessionid url will be unable to retrieve the data in the
> SessionState associated with the id. Do you think this means possbile?
> 2. If we also want to let the remote server be able to retrieve the
> sessiondata, I suggest that we still pass the urlstring without embeded
> sessionid , but also pass the SessionId string as separate data to that
> remote server together with the url string. How do you think of this?
> Please feel free to post here if you have any other questions or ideas.
> Thanks,
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
You're welcome Malcolm,

Good luck! :-)

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thursday, March 29, 2012

Session URL Formatting

Hello,
I have a problem with ASP.Net:
I have an ASP.Net application on a web farm, using SQL Server Session
State Management, running on Windows 2000 (IIS 5)
With session management on, a URL like the following is created:
https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
The problem I am having is that at some point within the web application
I have to pass this link to an outside server, which in turn,
will do some work and then post back to my application. However, the
outside application is URL Encoding my URL, which in turn,
causes the URL to look like:
mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
This cannot be handled by IIS, and induces a "page cannot be displayed
error"; which in effect, causes the application to terminate.
Is there any way that we can trap this error and redirect to the appropriate
location so that the web application does terminate, or is there a way
we can prevent the brackets within this application.
Hope I explained this correctly.
Appreciate any help.
Regards,
Malcolm KlotzOne approach - not clean - you can catch the IIS error code 404 and then
handle the issue on a redirect page. Sorry, I can't think of anything
cleaner at the moment.
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Malcolm Klotz" <nonesuch23@.online.nospam> wrote in message
news:OvlaLxATFHA.2812@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I have a problem with ASP.Net:
> I have an ASP.Net application on a web farm, using SQL Server Session
> State Management, running on Windows 2000 (IIS 5)
> With session management on, a URL like the following is created:
> https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
> The problem I am having is that at some point within the web
> application
> I have to pass this link to an outside server, which in turn,
> will do some work and then post back to my application. However, the
> outside application is URL Encoding my URL, which in turn,
> causes the URL to look like:
> mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
> This cannot be handled by IIS, and induces a "page cannot be displayed
> error"; which in effect, causes the application to terminate.
> Is there any way that we can trap this error and redirect to the
> appropriate
> location so that the web application does terminate, or is there a way
> we can prevent the brackets within this application.
> Hope I explained this correctly.
> Appreciate any help.
> Regards,
> Malcolm Klotz
>
Thanks for Alvin's inputs,
Hi Malcolm,
Since you are using the cookieless Session(embed sessionid in the url
string) in your web app, is there any particular requirement in your
scenario that we must use cookieless session? Is it possbile that we use
cookieenabled session instread?
Also, as for passing the url to a outside server, I think we have the
following means:
1. If we are forced to use cookieless session and with the sessionid
embeded in the url, I suggest that we filter the sessionid when pass the
url out to the remote server. For example:
when giving the following url
https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
we can use substring concating or regex to get the url without embeded
sessionid like:
https://mywebapp.com/start.aspx
this can also work for the remote requster, the only difference is that the
request with non-sessionid url will be unable to retrieve the data in the
SessionState associated with the id. Do you think this means possbile?
2. If we also want to let the remote server be able to retrieve the
sessiondata, I suggest that we still pass the urlstring without embeded
sessionid , but also pass the SessionId string as separate data to that
remote server together with the url string. How do you think of this?
Please feel free to post here if you have any other questions or ideas.
Thanks,
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thank you, you have given me a place to start.
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:eSJz3kGTFHA.2476@.TK2MSFTNGXA01.phx.gbl...
> Thanks for Alvin's inputs,
> Hi Malcolm,
> Since you are using the cookieless Session(embed sessionid in the url
> string) in your web app, is there any particular requirement in your
> scenario that we must use cookieless session? Is it possbile that we use
> cookieenabled session instread?
> Also, as for passing the url to a outside server, I think we have the
> following means:
> 1. If we are forced to use cookieless session and with the sessionid
> embeded in the url, I suggest that we filter the sessionid when pass the
> url out to the remote server. For example:
> when giving the following url
> https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
> we can use substring concating or regex to get the url without embeded
> sessionid like:
> https://mywebapp.com/start.aspx
> this can also work for the remote requster, the only difference is that
the
> request with non-sessionid url will be unable to retrieve the data in the
> SessionState associated with the id. Do you think this means possbile?
> 2. If we also want to let the remote server be able to retrieve the
> sessiondata, I suggest that we still pass the urlstring without embeded
> sessionid , but also pass the SessionId string as separate data to that
> remote server together with the url string. How do you think of this?
> Please feel free to post here if you have any other questions or ideas.
> Thanks,
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
You're welcome Malcolm,
Good luck! :-)
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Saturday, March 24, 2012

Session variable values being lost! Why?

I am running a site using ASP.NET and have discovered that values stored in session variables are being lost when moving from one page to another. I set the values on the first page and verify that the session variables are populated. Then, on another page, where my code needs to extract the values, the session variables have values of 'nothing'.

Has anyone encountered this and, if so, do you know how to fix it?Interesting...

Are you running ASP or ASPX pages?

Do you have session state enabled on the server?

Did it used to work?
I'm running ASPX pages. Session state is enabled. It works on my PC. I have other Websites on the same server and they work. In this application, I am using the following line in the Web.config file:

<identity impersonate = "true" />

The reason I'm playing with this is that I'm trying to set-up my application so that the Website runs on the Web server, but all the files that it accesses are on another server that is not exposed to the Web.
Dumb question but has to be asked: does your client allow cookies?

I don't see think the impersonation can be causing this. I'm doing the same thing as yourself and not having any problems.
Yes, the client allows cookies. If I put all of the files that the Website uses on the same server as the Website, there is no problem. However, I get this problem when I try to access files that are on another server using impersonation.

If I remove the following line...

<identity impersonate = "true" />

...and try to access the files on another server, I get the following message: "System.IO.IOException: Logon failure: unknown user name or bad password.". If I add the above line in, it still doesn't work properly. What happens then is that a dialog pops up asking me to log-in and, if I cancel, access to the other server is denied.

If I try the following line...

<identity impersonate="true" name="domain\user" password="something" />

...as it says can be used if you lookup "impersonation" in the help files, I get the following message: "Unrecognized attribute 'name'". I think the problem must be somehow related to authentication or the way I'm trying to use impersonation. Is there some other alternative way that I can go about doing this?
You're having a great day aren't you!

Your impersonate entry looks good to me.

Does your web.config authentication look like this:

<authentication mode="Windows" />
What are you doing for IIS authentication. You using Basic or Integrated? Definitely not Anonymous right?

I'm still amazed that this authentication issue is trashing your session variables.

What is your session state mode -- "InProc"?
Yes...what a wonderful day! Well, I appreciate that you're helping me out.

The authentication mode in Web.config is "Windows".

I had the authentication mode set to Integrated and now switched it to Basic. Since the site will have SSL, I guess Basic authentication should be okay to use. Now, when I go to the site, a login dialog appears. If I type in the user name and password, I get into the site and am able to access all of the files that are on the other server. I guess there must have been some problem with me using Integrated authentication.

My next question, then, is how to bypass the login dialog that appears when the user first navigates to the site. Can I add some code somewhere or change a setting to accomplish this?

If I use the following impersonate entry...

<identity impersonate="true" name="user" password="abc" />

...I still get the "Unrecognized attribute 'name'" error. Is there somewhere specifically within the web.config file that this line is supposed to appear?

The...

<identity impersonate="true" />

...line seems to be working now, since I am able to access the files on the other server from my Web application.
did you got the answer. I am getting same problem
No, I still haven't got a reply. I'm going to try assigning permissions to the IIS account on the other server and see if that will work using anonymous authentication.
it works fine if you use netscape's browser

Tuesday, March 13, 2012

Session variables disappear

Hi all,

We have a small problem.

We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
farm, on a single server, using in-proc session state, only using one worker
process.

The problem is that at seemingly random times, some of the session variables
return as if set to nothing.

We are using session variables to pass small objects from one page request
to the next. Which seems to work perfectly most of the time, but as I said
above, at random times, some but not all of the session variables return as
nothing.

Anyone any ideas?

Thanks in advance and Regards,
Simon.This is hard to diagnose without a lot of context information, but here is a
suggestion:

Try switching to cookieless for a while and see if the problem persists. If
not, then it may be some sort of cookie issue. The only other thing to be
aware of is that IIS process recycling will force you to lose session state.
The IIS settings on that may be too aggressive.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

"Simon" wrote:

> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one worker
> process.
> The problem is that at seemingly random times, some of the session variables
> return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return as
> nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
>
check the event log for asp.net recycles - these will clear inproc sessions.
(real production servers should not use inproc sessions for this reason)

-- bruce (sqlwork.com)

"Simon" <s@.v.c> wrote in message
news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one
> worker process.
> The problem is that at seemingly random times, some of the session
> variables return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return
> as nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
You can use performance monitor to see how often .NET application restarts.
When it does so all sessions are lost.

Couple reasons why application would restart.

1. new version of DLL was uploaded into BIN folder.
2. More than 15 aspx files were updated/added (15 is configurable value but
by default it's 15).
3. Folder in the project directory was created/removed.
4. There is antivirus active on the machine. Although it will not modify
aspx files it will trigger same sequence as it would. (See #2)
5. The application hanged or reached it's memory limit.

Also check eventlog there might be something in there especially if you have
case #5.

George.

"Simon" <s@.v.c> wrote in message
news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one
> worker process.
> The problem is that at seemingly random times, some of the session
> variables return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return
> as nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
Thanks for the reply,

What would you suggest we use instead of inproc.
We have looked at sqlserver, but all objects that you put in session must be
serializable, which some of them aren't

Thanks,
Simon.

"Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
news:%23uIZxwBLGHA.3064@.TK2MSFTNGP10.phx.gbl...
> check the event log for asp.net recycles - these will clear inproc
> sessions. (real production servers should not use inproc sessions for this
> reason)
> -- bruce (sqlwork.com)
> "Simon" <s@.v.c> wrote in message
> news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
>> Hi all,
>>
>> We have a small problem.
>>
>> We are running an ASP.NET1.1 application, using IIS6 on server2003, no
>> web farm, on a single server, using in-proc session state, only using one
>> worker process.
>>
>> The problem is that at seemingly random times, some of the session
>> variables return as if set to nothing.
>>
>> We are using session variables to pass small objects from one page
>> request to the next. Which seems to work perfectly most of the time, but
>> as I said above, at random times, some but not all of the session
>> variables return as nothing.
>>
>> Anyone any ideas?
>>
>> Thanks in advance and Regards,
>> Simon.
>>
Thanks for the reply George,

Surely if the application restarts, then all current sessions will end and
all session variables will disappear which we test for at the start of each
page load.

The problems occur after it has already returned several session items, and
then one of them comes back as nothing.

Perhaps the application is restarting mid request? is that possible? or is
it possible that objects can get GC'd when in session?

Regards,
Simon.

"George Ter-Saakov" <gt-nsp@.cardone.com> wrote in message
news:OToPtBCLGHA.536@.TK2MSFTNGP09.phx.gbl...
> You can use performance monitor to see how often .NET application
> restarts.
> When it does so all sessions are lost.
> Couple reasons why application would restart.
> 1. new version of DLL was uploaded into BIN folder.
> 2. More than 15 aspx files were updated/added (15 is configurable value
> but by default it's 15).
> 3. Folder in the project directory was created/removed.
> 4. There is antivirus active on the machine. Although it will not modify
> aspx files it will trigger same sequence as it would. (See #2)
> 5. The application hanged or reached it's memory limit.
> Also check eventlog there might be something in there especially if you
> have case #5.
>
>
> George.
>
> "Simon" <s@.v.c> wrote in message
> news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
>> Hi all,
>>
>> We have a small problem.
>>
>> We are running an ASP.NET1.1 application, using IIS6 on server2003, no
>> web farm, on a single server, using in-proc session state, only using one
>> worker process.
>>
>> The problem is that at seemingly random times, some of the session
>> variables return as if set to nothing.
>>
>> We are using session variables to pass small objects from one page
>> request to the next. Which seems to work perfectly most of the time, but
>> as I said above, at random times, some but not all of the session
>> variables return as nothing.
>>
>> Anyone any ideas?
>>
>> Thanks in advance and Regards,
>> Simon.
>>

Session variables disappear

Hi all,
We have a small problem.
We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
farm, on a single server, using in-proc session state, only using one worker
process.
The problem is that at seemingly random times, some of the session variables
return as if set to nothing.
We are using session variables to pass small objects from one page request
to the next. Which seems to work perfectly most of the time, but as I said
above, at random times, some but not all of the session variables return as
nothing.
Anyone any ideas?
Thanks in advance and Regards,
Simon.This is hard to diagnose without a lot of context information, but here is a
suggestion:
Try switching to cookieless for a while and see if the problem persists. If
not, then it may be some sort of cookie issue. The only other thing to be
aware of is that IIS process recycling will force you to lose session state.
The IIS settings on that may be too aggressive.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Simon" wrote:

> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one work
er
> process.
> The problem is that at seemingly random times, some of the session variabl
es
> return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return a
s
> nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
>
>
check the event log for asp.net recycles - these will clear inproc sessions.
(real production servers should not use inproc sessions for this reason)
-- bruce (sqlwork.com)
"Simon" <s@.v.c> wrote in message
news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one
> worker process.
> The problem is that at seemingly random times, some of the session
> variables return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return
> as nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
>
You can use performance monitor to see how often .NET application restarts.
When it does so all sessions are lost.
Couple reasons why application would restart.
1. new version of DLL was uploaded into BIN folder.
2. More than 15 aspx files were updated/added (15 is configurable value but
by default it's 15).
3. Folder in the project directory was created/removed.
4. There is antivirus active on the machine. Although it will not modify
aspx files it will trigger same sequence as it would. (See #2)
5. The application hanged or reached it's memory limit.
Also check eventlog there might be something in there especially if you have
case #5.
George.
"Simon" <s@.v.c> wrote in message
news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
> Hi all,
> We have a small problem.
> We are running an ASP.NET1.1 application, using IIS6 on server2003, no web
> farm, on a single server, using in-proc session state, only using one
> worker process.
> The problem is that at seemingly random times, some of the session
> variables return as if set to nothing.
> We are using session variables to pass small objects from one page request
> to the next. Which seems to work perfectly most of the time, but as I said
> above, at random times, some but not all of the session variables return
> as nothing.
> Anyone any ideas?
> Thanks in advance and Regards,
> Simon.
>
Thanks for the reply,
What would you suggest we use instead of inproc.
We have looked at sqlserver, but all objects that you put in session must be
serializable, which some of them aren't
Thanks,
Simon.
"Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
news:%23uIZxwBLGHA.3064@.TK2MSFTNGP10.phx.gbl...
> check the event log for asp.net recycles - these will clear inproc
> sessions. (real production servers should not use inproc sessions for this
> reason)
> -- bruce (sqlwork.com)
> "Simon" <s@.v.c> wrote in message
> news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
>
Thanks for the reply George,
Surely if the application restarts, then all current sessions will end and
all session variables will disappear which we test for at the start of each
page load.
The problems occur after it has already returned several session items, and
then one of them comes back as nothing.
Perhaps the application is restarting mid request? is that possible? or is
it possible that objects can get GC'd when in session?
Regards,
Simon.
"George Ter-Saakov" <gt-nsp@.cardone.com> wrote in message
news:OToPtBCLGHA.536@.TK2MSFTNGP09.phx.gbl...
> You can use performance monitor to see how often .NET application
> restarts.
> When it does so all sessions are lost.
> Couple reasons why application would restart.
> 1. new version of DLL was uploaded into BIN folder.
> 2. More than 15 aspx files were updated/added (15 is configurable value
> but by default it's 15).
> 3. Folder in the project directory was created/removed.
> 4. There is antivirus active on the machine. Although it will not modify
> aspx files it will trigger same sequence as it would. (See #2)
> 5. The application hanged or reached it's memory limit.
> Also check eventlog there might be something in there especially if you
> have case #5.
>
>
> George.
>
> "Simon" <s@.v.c> wrote in message
> news:43e8835f$0$82636$ed2619ec@.ptn-nntp-reader03.plus.net...
>

Session Variables Disappearing

Hello,

I am trying to develop a book tracking application for my capstone in
school, and am running into a problem.

The application is an ASP.Net application written in C#. The first page you
go to is a login form, which will set several session variables with the
name used to log in, appropriate security level and some other misc
variables, and then will go to a main menu for each particular security
level using Server.Transfer. Each main menu contains a user control at the
top showing the security level you are logged in as and the username that
you are logged in as.

From here, if I try to utilize a menu item (either hyperlink or a button
that uses Server.Transfer again) to go to a different page, the session
variables no longer seem to exist. For example, one such page goes to a
password change page, and also includes the same user control that the main
menu has at the top, however it doesn't list the information in the session
variables. In fact, it only shows part of the textual part as well. The
actual page itself uses another user control (basically a table with a few
fields on it) that calls a session variable, and that one doesn't show up
either.

I don't receive any errors, there just isn't anything that appears in these
fields. Each page has sessions enabled. If you have any suggestions,
PLEASE let me know!

If you would like to see what happens, take a look at
http://www.st-onge.org/class/dev/booktrack/default.aspx and use
tadmin/tadmin for the username/password. Right now the menu contains just a
button that is unlabeled, but that takes you to the password change utility.

Thanks in advance,
PaulHi Paul,

> I don't receive any errors, there just isn't anything that appears in these
> fields. Each page has sessions enabled. If you have any suggestions,
> PLEASE let me know!

You mentioned each page had session enabled. Is there a chance the
session is disabled in web.config? What does your <sessionState> element
look like?

Also, do you happen to have a <pages> element in web.config that
disables the session state for certain files?

Also, how do you cast values you read from the Session object?

--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers
Hello!

The session state information in the web.config is as follows:

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/
There is no <pages> element in the Web.config. I want to have the session
variables be available to all of the pages in the project.

Most of the variables that are in the session state are strings, so I use
(string) to cast them. For example, in the status bar user control, I use:
lblUserName.Text="Logged in using: " + Session["UserName"].ToString();

lblSecurity.Text="Security Level: " +
Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);

The first line accesses the session directly, and uses ToString() to get the
info. The second line I am casting it to an integer to throw into the
function. The funny thing with these and the status bar is once it logs on
and takes you to the menu, all of the info is currect, however if I move
past that, the first line produces 'Logged in using:' and that is it, while
the second line produces absolutely nothing.

Thanks for your help!

Paul

"Milan Negovan" <santa@.northpole.net> wrote in message
news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> Hi Paul,
>
> > I don't receive any errors, there just isn't anything that appears in
these
> > fields. Each page has sessions enabled. If you have any suggestions,
> > PLEASE let me know!
> You mentioned each page had session enabled. Is there a chance the
> session is disabled in web.config? What does your <sessionState> element
> look like?
> Also, do you happen to have a <pages> element in web.config that
> disables the session state for certain files?
> Also, how do you cast values you read from the Session object?
> --
> Milan Negovan
> www.AspNetResources.com
> Essential recources for ASP.NET developers
First think I'd do is look into the possibility that the session vars
are not yet established (after the Server.Transfer) when you hit the
Application_AuthenticationRequest event in Global.aspx. This is a
problem! It means you can't use the session vars. Using cookies is one
method I've read about (never implemented it myself.) Do a search for
FormsAuthenticationTicket, which is a cookie that can be created if you
are using Forms Authentication, and will be the first choice for setting
a cookie with the vars that you are now putting into session vars. I
guess there is a way to use other cookies, but the
FormsAuthenticationTicket cookie is supposed to be the best way to go.

It's a bummer - an aggravation, but there is a way to do it.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Thanks for the suggestion, however if this is the case then why does it work
the first time, and then stop working?

Thanks
Paul

"Paul" <nospampaulleblanc49@.msn.com> wrote in message
news:OrMKpID9DHA.2064@.TK2MSFTNGP11.phx.gbl...
> First think I'd do is look into the possibility that the session vars
> are not yet established (after the Server.Transfer) when you hit the
> Application_AuthenticationRequest event in Global.aspx. This is a
> problem! It means you can't use the session vars. Using cookies is one
> method I've read about (never implemented it myself.) Do a search for
> FormsAuthenticationTicket, which is a cookie that can be created if you
> are using Forms Authentication, and will be the first choice for setting
> a cookie with the vars that you are now putting into session vars. I
> guess there is a way to use other cookies, but the
> FormsAuthenticationTicket cookie is supposed to be the best way to go.
> It's a bummer - an aggravation, but there is a way to do it.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
The only way you can run ahead of Session is if you write an HttpModule or
HttpHandler and tap too early, i.e. before the session object is available
which is not what he's up to. What baffles me is why this produces noting at
all:

lblSecurity.Text="Security Level: " +
Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);

Something's weird. PaulY, can you zip up some code and put it up for
download? Remove sensitive information from code if you can.

--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers
you have custom controls on that page? custom controls cannot directly
access session, you need to first get a reference to the session object from
httpcontext.current.

If that still doesn't work, you will need to put code to display the session
variable in the page load and troubleshoot from there

if(Session["UserName"]!= null)
Response.Write("<script>alert('" + Session["UserName"].ToString() +
"')</script>");

should display something
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> Hello!
> The session state information in the web.config is as follows:
> <sessionState
> mode="InProc"
> stateConnectionString="tcpip=127.0.0.1:42424"
> sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> cookieless="false"
> timeout="20"
> />
> There is no <pages> element in the Web.config. I want to have the session
> variables be available to all of the pages in the project.
> Most of the variables that are in the session state are strings, so I use
> (string) to cast them. For example, in the status bar user control, I
use:
> lblUserName.Text="Logged in using: " + Session["UserName"].ToString();
> lblSecurity.Text="Security Level: " +
> Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> The first line accesses the session directly, and uses ToString() to get
the
> info. The second line I am casting it to an integer to throw into the
> function. The funny thing with these and the status bar is once it logs
on
> and takes you to the menu, all of the info is currect, however if I move
> past that, the first line produces 'Logged in using:' and that is it,
while
> the second line produces absolutely nothing.
> Thanks for your help!
> Paul
>
> "Milan Negovan" <santa@.northpole.net> wrote in message
> news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > Hi Paul,
> > > I don't receive any errors, there just isn't anything that appears in
> these
> > > fields. Each page has sessions enabled. If you have any suggestions,
> > > PLEASE let me know!
> > You mentioned each page had session enabled. Is there a chance the
> > session is disabled in web.config? What does your <sessionState> element
> > look like?
> > Also, do you happen to have a <pages> element in web.config that
> > disables the session state for certain files?
> > Also, how do you cast values you read from the Session object?
> > --
> > Milan Negovan
> > www.AspNetResources.com
> > Essential recources for ASP.NET developers
It'll be helpful to see how you authenticate the user, set an authentication
cookie and store info in the session...

--
Milan Negovan
www.AspNetResources.com
Essential recources for ASP.NET developers
hi,
also before accessing session variabls..
just check for its existence...
if Session["key"]!=null then
only access..

--
Thanks and Regards,

Amit Agarwal
Software Programmer(.NET)
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:7Lydnbe8_v6OoK3dRVn2gw@.giganews.com...
> Thanks for the suggestion, however if this is the case then why does it
work
> the first time, and then stop working?
> Thanks
> Paul
> "Paul" <nospampaulleblanc49@.msn.com> wrote in message
> news:OrMKpID9DHA.2064@.TK2MSFTNGP11.phx.gbl...
> > First think I'd do is look into the possibility that the session vars
> > are not yet established (after the Server.Transfer) when you hit the
> > Application_AuthenticationRequest event in Global.aspx. This is a
> > problem! It means you can't use the session vars. Using cookies is one
> > method I've read about (never implemented it myself.) Do a search for
> > FormsAuthenticationTicket, which is a cookie that can be created if you
> > are using Forms Authentication, and will be the first choice for setting
> > a cookie with the vars that you are now putting into session vars. I
> > guess there is a way to use other cookies, but the
> > FormsAuthenticationTicket cookie is supposed to be the best way to go.
> > It's a bummer - an aggravation, but there is a way to do it.
> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it!

--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.587 / Virus Database: 371 - Release Date: 2/12/2004
Thanks for the suggestion! I do have one question though, that being the
case, why does it work once, but not once I move on from that page?

Thanks
Paul
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> you have custom controls on that page? custom controls cannot directly
> access session, you need to first get a reference to the session object
from
> httpcontext.current.
> If that still doesn't work, you will need to put code to display the
session
> variable in the page load and troubleshoot from there
> if(Session["UserName"]!= null)
> Response.Write("<script>alert('" + Session["UserName"].ToString() +
> "')</script>");
> should display something
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > Hello!
> > The session state information in the web.config is as follows:
> > <sessionState
> > mode="InProc"
> > stateConnectionString="tcpip=127.0.0.1:42424"
> > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > cookieless="false"
> > timeout="20"
> > />
> > There is no <pages> element in the Web.config. I want to have the
session
> > variables be available to all of the pages in the project.
> > Most of the variables that are in the session state are strings, so I
use
> > (string) to cast them. For example, in the status bar user control, I
> use:
> > lblUserName.Text="Logged in using: " + Session["UserName"].ToString();
> > lblSecurity.Text="Security Level: " +
> > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > The first line accesses the session directly, and uses ToString() to get
> the
> > info. The second line I am casting it to an integer to throw into the
> > function. The funny thing with these and the status bar is once it logs
> on
> > and takes you to the menu, all of the info is currect, however if I move
> > past that, the first line produces 'Logged in using:' and that is it,
> while
> > the second line produces absolutely nothing.
> > Thanks for your help!
> > Paul
> > "Milan Negovan" <santa@.northpole.net> wrote in message
> > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > Hi Paul,
> > > > > > I don't receive any errors, there just isn't anything that appears
in
> > these
> > > > fields. Each page has sessions enabled. If you have any
suggestions,
> > > > PLEASE let me know!
> > > > You mentioned each page had session enabled. Is there a chance the
> > > session is disabled in web.config? What does your <sessionState>
element
> > > look like?
> > > > Also, do you happen to have a <pages> element in web.config that
> > > disables the session state for certain files?
> > > > Also, how do you cast values you read from the Session object?
> > > > --
> > > Milan Negovan
> > > www.AspNetResources.com
> > > Essential recources for ASP.NET developers
i really have no idea. if you can't figure this out, i 'd be happy to look
at the code

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> Thanks for the suggestion! I do have one question though, that being the
> case, why does it work once, but not once I move on from that page?
> Thanks
> Paul
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > you have custom controls on that page? custom controls cannot directly
> > access session, you need to first get a reference to the session object
> from
> > httpcontext.current.
> > If that still doesn't work, you will need to put code to display the
> session
> > variable in the page load and troubleshoot from there
> > if(Session["UserName"]!= null)
> > Response.Write("<script>alert('" + Session["UserName"].ToString() +
> > "')</script>");
> > should display something
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > Hello!
> > > > The session state information in the web.config is as follows:
> > > > <sessionState
> > > > mode="InProc"
> > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > > cookieless="false"
> > > > timeout="20"
> > > > />
> > > > There is no <pages> element in the Web.config. I want to have the
> session
> > > variables be available to all of the pages in the project.
> > > > Most of the variables that are in the session state are strings, so I
> use
> > > (string) to cast them. For example, in the status bar user control, I
> > use:
> > > lblUserName.Text="Logged in using: " + Session["UserName"].ToString();
> > > > lblSecurity.Text="Security Level: " +
> > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > The first line accesses the session directly, and uses ToString() to
get
> > the
> > > info. The second line I am casting it to an integer to throw into the
> > > function. The funny thing with these and the status bar is once it
logs
> > on
> > > and takes you to the menu, all of the info is currect, however if I
move
> > > past that, the first line produces 'Logged in using:' and that is it,
> > while
> > > the second line produces absolutely nothing.
> > > > Thanks for your help!
> > > > Paul
> > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > Hi Paul,
> > > > > > > > > I don't receive any errors, there just isn't anything that appears
> in
> > > these
> > > > > fields. Each page has sessions enabled. If you have any
> suggestions,
> > > > > PLEASE let me know!
> > > > > > You mentioned each page had session enabled. Is there a chance the
> > > > session is disabled in web.config? What does your <sessionState>
> element
> > > > look like?
> > > > > > Also, do you happen to have a <pages> element in web.config that
> > > > disables the session state for certain files?
> > > > > > Also, how do you cast values you read from the Session object?
> > > > > > --
> > > > Milan Negovan
> > > > www.AspNetResources.com
> > > > Essential recources for ASP.NET developers
> >
I may have to have you do that if you are willing...

Some more info..

From the login form (a form with a user control), the user control sets the
session variables. Using Server.Transfer, I move to another page, the main
menu. This has a user control (the user status info) which pulls the
session variables fine. I inserted a label just to pull the information
from a session variable, and that works. The button on the form, which uses
a Server.Transfer to go to another page with a user control to change the
password, is where things break. The same control on the main menu that
produced info, no longer works. The other user control on that page,
doesn't work either, nor does the same process to get session information
prior.

I think I am just doing something stupid here...

Thanks
Paul
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> i really have no idea. if you can't figure this out, i 'd be happy to look
> at the code
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > Thanks for the suggestion! I do have one question though, that being
the
> > case, why does it work once, but not once I move on from that page?
> > Thanks
> > Paul
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > you have custom controls on that page? custom controls cannot directly
> > > access session, you need to first get a reference to the session
object
> > from
> > > httpcontext.current.
> > > > If that still doesn't work, you will need to put code to display the
> > session
> > > variable in the page load and troubleshoot from there
> > > > if(Session["UserName"]!= null)
> > > Response.Write("<script>alert('" + Session["UserName"].ToString()
+
> > > "')</script>");
> > > > should display something
> > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > Hello!
> > > > > > The session state information in the web.config is as follows:
> > > > > > <sessionState
> > > > > > mode="InProc"
> > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > > > > cookieless="false"
> > > > > > timeout="20"
> > > > > > />
> > > > > > There is no <pages> element in the Web.config. I want to have the
> > session
> > > > variables be available to all of the pages in the project.
> > > > > > Most of the variables that are in the session state are strings, so
I
> > use
> > > > (string) to cast them. For example, in the status bar user control,
I
> > > use:
> > > > lblUserName.Text="Logged in using: " +
Session["UserName"].ToString();
> > > > > > lblSecurity.Text="Security Level: " +
> > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > The first line accesses the session directly, and uses ToString() to
> get
> > > the
> > > > info. The second line I am casting it to an integer to throw into
the
> > > > function. The funny thing with these and the status bar is once it
> logs
> > > on
> > > > and takes you to the menu, all of the info is currect, however if I
> move
> > > > past that, the first line produces 'Logged in using:' and that is
it,
> > > while
> > > > the second line produces absolutely nothing.
> > > > > > Thanks for your help!
> > > > > > Paul
> > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > Hi Paul,
> > > > > > > > > > > > I don't receive any errors, there just isn't anything that
appears
> > in
> > > > these
> > > > > > fields. Each page has sessions enabled. If you have any
> > suggestions,
> > > > > > PLEASE let me know!
> > > > > > > > You mentioned each page had session enabled. Is there a chance the
> > > > > session is disabled in web.config? What does your <sessionState>
> > element
> > > > > look like?
> > > > > > > > Also, do you happen to have a <pages> element in web.config that
> > > > > disables the session state for certain files?
> > > > > > > > Also, how do you cast values you read from the Session object?
> > > > > > > > --
> > > > > Milan Negovan
> > > > > www.AspNetResources.com
> > > > > Essential recources for ASP.NET developers
> > > > > >
I should also mention I tried using httpcontext too, same thing...

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> i really have no idea. if you can't figure this out, i 'd be happy to look
> at the code
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > Thanks for the suggestion! I do have one question though, that being
the
> > case, why does it work once, but not once I move on from that page?
> > Thanks
> > Paul
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > you have custom controls on that page? custom controls cannot directly
> > > access session, you need to first get a reference to the session
object
> > from
> > > httpcontext.current.
> > > > If that still doesn't work, you will need to put code to display the
> > session
> > > variable in the page load and troubleshoot from there
> > > > if(Session["UserName"]!= null)
> > > Response.Write("<script>alert('" + Session["UserName"].ToString()
+
> > > "')</script>");
> > > > should display something
> > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > Hello!
> > > > > > The session state information in the web.config is as follows:
> > > > > > <sessionState
> > > > > > mode="InProc"
> > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > > > > cookieless="false"
> > > > > > timeout="20"
> > > > > > />
> > > > > > There is no <pages> element in the Web.config. I want to have the
> > session
> > > > variables be available to all of the pages in the project.
> > > > > > Most of the variables that are in the session state are strings, so
I
> > use
> > > > (string) to cast them. For example, in the status bar user control,
I
> > > use:
> > > > lblUserName.Text="Logged in using: " +
Session["UserName"].ToString();
> > > > > > lblSecurity.Text="Security Level: " +
> > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > The first line accesses the session directly, and uses ToString() to
> get
> > > the
> > > > info. The second line I am casting it to an integer to throw into
the
> > > > function. The funny thing with these and the status bar is once it
> logs
> > > on
> > > > and takes you to the menu, all of the info is currect, however if I
> move
> > > > past that, the first line produces 'Logged in using:' and that is
it,
> > > while
> > > > the second line produces absolutely nothing.
> > > > > > Thanks for your help!
> > > > > > Paul
> > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > Hi Paul,
> > > > > > > > > > > > I don't receive any errors, there just isn't anything that
appears
> > in
> > > > these
> > > > > > fields. Each page has sessions enabled. If you have any
> > suggestions,
> > > > > > PLEASE let me know!
> > > > > > > > You mentioned each page had session enabled. Is there a chance the
> > > > > session is disabled in web.config? What does your <sessionState>
> > element
> > > > > look like?
> > > > > > > > Also, do you happen to have a <pages> element in web.config that
> > > > > disables the session state for certain files?
> > > > > > > > Also, how do you cast values you read from the Session object?
> > > > > > > > --
> > > > > Milan Negovan
> > > > > www.AspNetResources.com
> > > > > Essential recources for ASP.NET developers
> > > > > >
Sure, post the code which reproduces the problem.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> I should also mention I tried using httpcontext too, same thing...
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > i really have no idea. if you can't figure this out, i 'd be happy to
look
> > at the code
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > Thanks for the suggestion! I do have one question though, that being
> the
> > > case, why does it work once, but not once I move on from that page?
> > > > Thanks
> > > Paul
> > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > you have custom controls on that page? custom controls cannot
directly
> > > > access session, you need to first get a reference to the session
> object
> > > from
> > > > httpcontext.current.
> > > > > > If that still doesn't work, you will need to put code to display the
> > > session
> > > > variable in the page load and troubleshoot from there
> > > > > > if(Session["UserName"]!= null)
> > > > Response.Write("<script>alert('" +
Session["UserName"].ToString()
> +
> > > > "')</script>");
> > > > > > should display something
> > > > --
> > > > Regards,
> > > > Alvin Bruney [ASP.NET MVP]
> > > > Got tidbits? Get it here...
> > > > http://tinyurl.com/3he3b
> > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > Hello!
> > > > > > > > The session state information in the web.config is as follows:
> > > > > > > > <sessionState
> > > > > > > > mode="InProc"
> > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > cookieless="false"
> > > > > > > > timeout="20"
> > > > > > > > />
> > > > > > > > There is no <pages> element in the Web.config. I want to have the
> > > session
> > > > > variables be available to all of the pages in the project.
> > > > > > > > Most of the variables that are in the session state are strings,
so
> I
> > > use
> > > > > (string) to cast them. For example, in the status bar user
control,
> I
> > > > use:
> > > > > lblUserName.Text="Logged in using: " +
> Session["UserName"].ToString();
> > > > > > > > lblSecurity.Text="Security Level: " +
> > > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > The first line accesses the session directly, and uses ToString()
to
> > get
> > > > the
> > > > > info. The second line I am casting it to an integer to throw into
> the
> > > > > function. The funny thing with these and the status bar is once
it
> > logs
> > > > on
> > > > > and takes you to the menu, all of the info is currect, however if
I
> > move
> > > > > past that, the first line produces 'Logged in using:' and that is
> it,
> > > > while
> > > > > the second line produces absolutely nothing.
> > > > > > > > Thanks for your help!
> > > > > > > > Paul
> > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > Hi Paul,
> > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything that
> appears
> > > in
> > > > > these
> > > > > > > fields. Each page has sessions enabled. If you have any
> > > suggestions,
> > > > > > > PLEASE let me know!
> > > > > > > > > > You mentioned each page had session enabled. Is there a chance
the
> > > > > > session is disabled in web.config? What does your <sessionState>
> > > element
> > > > > > look like?
> > > > > > > > > > Also, do you happen to have a <pages> element in web.config that
> > > > > > disables the session state for certain files?
> > > > > > > > > > Also, how do you cast values you read from the Session object?
> > > > > > > > > > --
> > > > > > Milan Negovan
> > > > > > www.AspNetResources.com
> > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > >
Sorry for the delay, I have tried posting the project as an attachment,
isn't working, so here is the code:

Default.aspx has no code, just the login control. Code is below:

namespace BookTrack.UserControls

{

using System;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Web.SessionState;

/// <summary
/// Summary description for WebUserControl1.

/// </summary
public class WebUserControl1 : System.Web.UI.UserControl

{

protected System.Web.UI.WebControls.TextBox txtUserName;

protected System.Web.UI.WebControls.TextBox txtPassword;

protected System.Web.UI.WebControls.Label txtError;

protected System.Web.UI.WebControls.Button btnCheckLogin;

private void Page_Load(object sender, System.EventArgs e)

{

if(!IsPostBack)

{

txtError.Text="";

Session["UserID"]="";

Session["SecurityLevel"]="";

Session["UserName"]="";

}

}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

/// <summary
/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary
private void InitializeComponent()

{

this.btnCheckLogin.Click += new
System.EventHandler(this.btnCheckLogin_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void btnCheckLogin_Click(object sender, System.EventArgs e)

{

Auth Authentication = new Auth();

try

{

Session["UserID"]=Authentication.GetUserID(txtUserName.Text,txtPass word.Text
);

Session["SecurityLevel"]=Authentication.GetSecurityLevel((int)Session["UserI
D"]);

Session["UserName"]=txtUserName.Text;

Session["PassChange"]=txtUserName.Text;

txtError.Text="";

Server.Transfer(Authentication.GetMainMenu((int)Se ssion["SecurityLevel"]));

}

catch

{

Session["UserID"]="";

Session["SecurityLevel"]="";

Session["UserName"]="";

txtError.Text="You have entered incorrect user login credentials, please try
again";

}

}

}

}

From there, they get sent to a menu based off of the function called in the
CheckLogin_Click function. The Auth class is just a class I am using for DB
connection items.

Depending on who you log in as, you go to a main menu (different menu
depending on your credentials). Each menu (right now) is a blank page, with
the LoginStatusBar user control, giving information as to who they are
logged in as. The code for the LoginStatusBar.ascx.cs is below:

namespace BookTrack.UserControls

{

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

/// <summary
/// Summary description for LoginStatusBar.

/// </summary
public class LoginStatusBar : System.Web.UI.UserControl

{

int LogOutFlag=0;

HttpContext current = HttpContext.Current;

Auth Authenticate = new Auth();

protected System.Web.UI.WebControls.Label lblUserName;

protected System.Web.UI.WebControls.Button btnLogout;

protected System.Web.UI.WebControls.Label lblSecurity;

private void Page_Load(object sender, System.EventArgs e)

{

if(LogOutFlag==0)

{

try

{

lblUserName.Text="Logged in using: " +
current.Session["UserName"].ToString();

lblSecurity.Text="Security Level: " +
Authenticate.GetSecurityLevelText((int)current.Ses sion["SecurityLevel"]);

}

catch

{

}

}

}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

/// <summary
/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary
private void InitializeComponent()

{

this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void btnLogout_Click(object sender, System.EventArgs e)

{

LogOutFlag=1;

Server.Transfer("../Default.aspx");

}

}

}

Up to this point, everything works fine.

One of the menus, I created a button and have it using Server.Transfer to
move to a password change page. It again has the same login status bar,
however this is where things break. It will produce the 'Logged in using:"
piece, and that is it. The "Security Level:" piece never shows up. In the
main page, I created a label to get the session variable, and it produces
nothing. The code for the Password Change.ascx.cs is below:

namespace BookTrack.UserControls

{

using System;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

/// <summary
/// Summary description for PasswordChange.

/// </summary
public class PasswordChange : System.Web.UI.UserControl

{

protected System.Web.UI.WebControls.Button btnChangePassword;

protected System.Web.UI.WebControls.Label Label4;

protected System.Web.UI.WebControls.Label Label3;

protected System.Web.UI.WebControls.Label Label2;

protected System.Web.UI.WebControls.Label Label1;

protected System.Web.UI.WebControls.TextBox txtConfirmPassword;

protected System.Web.UI.WebControls.TextBox txtNewPassword;

protected System.Web.UI.WebControls.TextBox txtOldPassword;

protected System.Web.UI.WebControls.Label lblUserName;

protected System.Web.UI.WebControls.CompareValidator vldNewPass;

Auth Authenticate = new Auth();

private void Page_Load(object sender, System.EventArgs e)

{

lblUserName.Text=Session["UserName"].ToString();

}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

/// <summary
/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary
private void InitializeComponent()

{

this.btnChangePassword.Click += new
System.EventHandler(this.btnChangePassword_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void btnChangePassword_Click(object sender, System.EventArgs e)

{

try

{

if((bool)Authenticate.ChangePassword((string)Sessi on["UserName"],txtOldPassw
ord.Text,txtNewPassword.Text))

{

Server.Transfer(Authenticate.GetMainMenu((int)Sess ion["SecurityLevel"]));

}

}

catch

{

}

}

}

}

If you need any more info, please let me know.

Paul

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:estSzvR9DHA.1052@.TK2MSFTNGP12.phx.gbl...
> Sure, post the code which reproduces the problem.
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> > I should also mention I tried using httpcontext too, same thing...
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > > i really have no idea. if you can't figure this out, i 'd be happy to
> look
> > > at the code
> > > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > > Thanks for the suggestion! I do have one question though, that
being
> > the
> > > > case, why does it work once, but not once I move on from that page?
> > > > > > Thanks
> > > > Paul
> > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
> > > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > > you have custom controls on that page? custom controls cannot
> directly
> > > > > access session, you need to first get a reference to the session
> > object
> > > > from
> > > > > httpcontext.current.
> > > > > > > > If that still doesn't work, you will need to put code to display
the
> > > > session
> > > > > variable in the page load and troubleshoot from there
> > > > > > > > if(Session["UserName"]!= null)
> > > > > Response.Write("<script>alert('" +
> Session["UserName"].ToString()
> > +
> > > > > "')</script>");
> > > > > > > > should display something
> > > > > --
> > > > > Regards,
> > > > > Alvin Bruney [ASP.NET MVP]
> > > > > Got tidbits? Get it here...
> > > > > http://tinyurl.com/3he3b
> > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > > Hello!
> > > > > > > > > > The session state information in the web.config is as follows:
> > > > > > > > > > <sessionState
> > > > > > > > > > mode="InProc"
> > > > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > > > sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > > > cookieless="false"
> > > > > > > > > > timeout="20"
> > > > > > > > > > />
> > > > > > > > > > There is no <pages> element in the Web.config. I want to have
the
> > > > session
> > > > > > variables be available to all of the pages in the project.
> > > > > > > > > > Most of the variables that are in the session state are strings,
> so
> > I
> > > > use
> > > > > > (string) to cast them. For example, in the status bar user
> control,
> > I
> > > > > use:
> > > > > > lblUserName.Text="Logged in using: " +
> > Session["UserName"].ToString();
> > > > > > > > > > lblSecurity.Text="Security Level: " +
> > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > > > The first line accesses the session directly, and uses
ToString()
> to
> > > get
> > > > > the
> > > > > > info. The second line I am casting it to an integer to throw
into
> > the
> > > > > > function. The funny thing with these and the status bar is once
> it
> > > logs
> > > > > on
> > > > > > and takes you to the menu, all of the info is currect, however
if
> I
> > > move
> > > > > > past that, the first line produces 'Logged in using:' and that
is
> > it,
> > > > > while
> > > > > > the second line produces absolutely nothing.
> > > > > > > > > > Thanks for your help!
> > > > > > > > > > Paul
> > > > > > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > > Hi Paul,
> > > > > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything that
> > appears
> > > > in
> > > > > > these
> > > > > > > > fields. Each page has sessions enabled. If you have any
> > > > suggestions,
> > > > > > > > PLEASE let me know!
> > > > > > > > > > > > You mentioned each page had session enabled. Is there a chance
> the
> > > > > > > session is disabled in web.config? What does your
<sessionState>
> > > > element
> > > > > > > look like?
> > > > > > > > > > > > Also, do you happen to have a <pages> element in web.config
that
> > > > > > > disables the session state for certain files?
> > > > > > > > > > > > Also, how do you cast values you read from the Session object?
> > > > > > > > > > > > --
> > > > > > > Milan Negovan
> > > > > > > www.AspNetResources.com
> > > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > > > > > > > > > >
Your class for your webform does not descend from UI page. What's the reason
for this?
Example:

public class WebForm1 : System.Web.UI.Page

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:X8WdnRlAxbkKCq7dRVn2iQ@.giganews.com...
> Sorry for the delay, I have tried posting the project as an attachment,
> isn't working, so here is the code:
> Default.aspx has no code, just the login control. Code is below:
> namespace BookTrack.UserControls
> {
> using System;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> using System.Web.SessionState;
> /// <summary>
> /// Summary description for WebUserControl1.
> /// </summary>
> public class WebUserControl1 : System.Web.UI.UserControl
> {
> protected System.Web.UI.WebControls.TextBox txtUserName;
> protected System.Web.UI.WebControls.TextBox txtPassword;
> protected System.Web.UI.WebControls.Label txtError;
> protected System.Web.UI.WebControls.Button btnCheckLogin;
> private void Page_Load(object sender, System.EventArgs e)
> {
> if(!IsPostBack)
> {
> txtError.Text="";
> Session["UserID"]="";
> Session["SecurityLevel"]="";
> Session["UserName"]="";
> }
> }
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.btnCheckLogin.Click += new
> System.EventHandler(this.btnCheckLogin_Click);
> this.Load += new System.EventHandler(this.Page_Load);
> }
> #endregion
> private void btnCheckLogin_Click(object sender, System.EventArgs e)
> {
> Auth Authentication = new Auth();
> try
> {
>
Session["UserID"]=Authentication.GetUserID(txtUserName.Text,txtPass word.Text
> );
>
Session["SecurityLevel"]=Authentication.GetSecurityLevel((int)Session["UserI
> D"]);
> Session["UserName"]=txtUserName.Text;
> Session["PassChange"]=txtUserName.Text;
> txtError.Text="";
>
Server.Transfer(Authentication.GetMainMenu((int)Se ssion["SecurityLevel"]));
> }
> catch
> {
> Session["UserID"]="";
> Session["SecurityLevel"]="";
> Session["UserName"]="";
> txtError.Text="You have entered incorrect user login credentials, please
try
> again";
> }
> }
> }
> }
>
> From there, they get sent to a menu based off of the function called in
the
> CheckLogin_Click function. The Auth class is just a class I am using for
DB
> connection items.
> Depending on who you log in as, you go to a main menu (different menu
> depending on your credentials). Each menu (right now) is a blank page,
with
> the LoginStatusBar user control, giving information as to who they are
> logged in as. The code for the LoginStatusBar.ascx.cs is below:
> namespace BookTrack.UserControls
> {
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.SessionState;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> /// <summary>
> /// Summary description for LoginStatusBar.
> /// </summary>
> public class LoginStatusBar : System.Web.UI.UserControl
> {
> int LogOutFlag=0;
> HttpContext current = HttpContext.Current;
> Auth Authenticate = new Auth();
> protected System.Web.UI.WebControls.Label lblUserName;
> protected System.Web.UI.WebControls.Button btnLogout;
> protected System.Web.UI.WebControls.Label lblSecurity;
> private void Page_Load(object sender, System.EventArgs e)
> {
> if(LogOutFlag==0)
> {
> try
> {
> lblUserName.Text="Logged in using: " +
> current.Session["UserName"].ToString();
> lblSecurity.Text="Security Level: " +
> Authenticate.GetSecurityLevelText((int)current.Ses sion["SecurityLevel"]);
> }
> catch
> {
> }
> }
> }
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
> this.Load += new System.EventHandler(this.Page_Load);
> }
> #endregion
> private void btnLogout_Click(object sender, System.EventArgs e)
> {
> LogOutFlag=1;
> Server.Transfer("../Default.aspx");
>
> }
> }
> }
> Up to this point, everything works fine.
> One of the menus, I created a button and have it using Server.Transfer to
> move to a password change page. It again has the same login status bar,
> however this is where things break. It will produce the 'Logged in
using:"
> piece, and that is it. The "Security Level:" piece never shows up. In
the
> main page, I created a label to get the session variable, and it produces
> nothing. The code for the Password Change.ascx.cs is below:
>
> namespace BookTrack.UserControls
> {
> using System;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> /// <summary>
> /// Summary description for PasswordChange.
> /// </summary>
> public class PasswordChange : System.Web.UI.UserControl
> {
> protected System.Web.UI.WebControls.Button btnChangePassword;
> protected System.Web.UI.WebControls.Label Label4;
> protected System.Web.UI.WebControls.Label Label3;
> protected System.Web.UI.WebControls.Label Label2;
> protected System.Web.UI.WebControls.Label Label1;
> protected System.Web.UI.WebControls.TextBox txtConfirmPassword;
> protected System.Web.UI.WebControls.TextBox txtNewPassword;
> protected System.Web.UI.WebControls.TextBox txtOldPassword;
> protected System.Web.UI.WebControls.Label lblUserName;
> protected System.Web.UI.WebControls.CompareValidator vldNewPass;
> Auth Authenticate = new Auth();
> private void Page_Load(object sender, System.EventArgs e)
> {
> lblUserName.Text=Session["UserName"].ToString();
> }
> #region Web Form Designer generated code
> override protected void OnInit(EventArgs e)
> {
> //
> // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> //
> InitializeComponent();
> base.OnInit(e);
> }
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.btnChangePassword.Click += new
> System.EventHandler(this.btnChangePassword_Click);
> this.Load += new System.EventHandler(this.Page_Load);
> }
> #endregion
> private void btnChangePassword_Click(object sender, System.EventArgs e)
> {
> try
> {
>
if((bool)Authenticate.ChangePassword((string)Sessi on["UserName"],txtOldPassw
> ord.Text,txtNewPassword.Text))
> {
> Server.Transfer(Authenticate.GetMainMenu((int)Sess ion["SecurityLevel"]));
> }
> }
> catch
> {
> }
>
> }
> }
> }
>
> If you need any more info, please let me know.
>
> Paul
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:estSzvR9DHA.1052@.TK2MSFTNGP12.phx.gbl...
> > Sure, post the code which reproduces the problem.
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> > > I should also mention I tried using httpcontext too, same thing...
> > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > > news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > > > i really have no idea. if you can't figure this out, i 'd be happy
to
> > look
> > > > at the code
> > > > > > --
> > > > Regards,
> > > > Alvin Bruney [ASP.NET MVP]
> > > > Got tidbits? Get it here...
> > > > http://tinyurl.com/3he3b
> > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > > > Thanks for the suggestion! I do have one question though, that
> being
> > > the
> > > > > case, why does it work once, but not once I move on from that
page?
> > > > > > > > Thanks
> > > > > Paul
> > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
> message
> > > > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > > > you have custom controls on that page? custom controls cannot
> > directly
> > > > > > access session, you need to first get a reference to the session
> > > object
> > > > > from
> > > > > > httpcontext.current.
> > > > > > > > > > If that still doesn't work, you will need to put code to display
> the
> > > > > session
> > > > > > variable in the page load and troubleshoot from there
> > > > > > > > > > if(Session["UserName"]!= null)
> > > > > > Response.Write("<script>alert('" +
> > Session["UserName"].ToString()
> > > +
> > > > > > "')</script>");
> > > > > > > > > > should display something
> > > > > > --
> > > > > > Regards,
> > > > > > Alvin Bruney [ASP.NET MVP]
> > > > > > Got tidbits? Get it here...
> > > > > > http://tinyurl.com/3he3b
> > > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > > > Hello!
> > > > > > > > > > > > The session state information in the web.config is as follows:
> > > > > > > > > > > > <sessionState
> > > > > > > > > > > > mode="InProc"
> > > > > > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > > > > > sqlConnectionString="data
> source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > > > > > cookieless="false"
> > > > > > > > > > > > timeout="20"
> > > > > > > > > > > > />
> > > > > > > > > > > > There is no <pages> element in the Web.config. I want to have
> the
> > > > > session
> > > > > > > variables be available to all of the pages in the project.
> > > > > > > > > > > > Most of the variables that are in the session state are
strings,
> > so
> > > I
> > > > > use
> > > > > > > (string) to cast them. For example, in the status bar user
> > control,
> > > I
> > > > > > use:
> > > > > > > lblUserName.Text="Logged in using: " +
> > > Session["UserName"].ToString();
> > > > > > > > > > > > lblSecurity.Text="Security Level: " +
> > > > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > > > > > The first line accesses the session directly, and uses
> ToString()
> > to
> > > > get
> > > > > > the
> > > > > > > info. The second line I am casting it to an integer to throw
> into
> > > the
> > > > > > > function. The funny thing with these and the status bar is
once
> > it
> > > > logs
> > > > > > on
> > > > > > > and takes you to the menu, all of the info is currect, however
> if
> > I
> > > > move
> > > > > > > past that, the first line produces 'Logged in using:' and that
> is
> > > it,
> > > > > > while
> > > > > > > the second line produces absolutely nothing.
> > > > > > > > > > > > Thanks for your help!
> > > > > > > > > > > > Paul
> > > > > > > > > > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > > > Hi Paul,
> > > > > > > > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything that
> > > appears
> > > > > in
> > > > > > > these
> > > > > > > > > fields. Each page has sessions enabled. If you have any
> > > > > suggestions,
> > > > > > > > > PLEASE let me know!
> > > > > > > > > > > > > > You mentioned each page had session enabled. Is there a
chance
> > the
> > > > > > > > session is disabled in web.config? What does your
> <sessionState>
> > > > > element
> > > > > > > > look like?
> > > > > > > > > > > > > > Also, do you happen to have a <pages> element in web.config
> that
> > > > > > > > disables the session state for certain files?
> > > > > > > > > > > > > > Also, how do you cast values you read from the Session
object?
> > > > > > > > > > > > > > --
> > > > > > > > Milan Negovan
> > > > > > > > www.AspNetResources.com
> > > > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
There really isn't a reason... In fact, I didn't change from the defaults.
Is this causing the issue?

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:umJTAh29DHA.2168@.TK2MSFTNGP12.phx.gbl...
> Your class for your webform does not descend from UI page. What's the
reason
> for this?
> Example:
> public class WebForm1 : System.Web.UI.Page
>
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:X8WdnRlAxbkKCq7dRVn2iQ@.giganews.com...
> > Sorry for the delay, I have tried posting the project as an attachment,
> > isn't working, so here is the code:
> > Default.aspx has no code, just the login control. Code is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > using System.Web.SessionState;
> > /// <summary>
> > /// Summary description for WebUserControl1.
> > /// </summary>
> > public class WebUserControl1 : System.Web.UI.UserControl
> > {
> > protected System.Web.UI.WebControls.TextBox txtUserName;
> > protected System.Web.UI.WebControls.TextBox txtPassword;
> > protected System.Web.UI.WebControls.Label txtError;
> > protected System.Web.UI.WebControls.Button btnCheckLogin;
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > if(!IsPostBack)
> > {
> > txtError.Text="";
> > Session["UserID"]="";
> > Session["SecurityLevel"]="";
> > Session["UserName"]="";
> > }
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnCheckLogin.Click += new
> > System.EventHandler(this.btnCheckLogin_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnCheckLogin_Click(object sender, System.EventArgs e)
> > {
> > Auth Authentication = new Auth();
> > try
> > {
Session["UserID"]=Authentication.GetUserID(txtUserName.Text,txtPass word.Text
> > );
Session["SecurityLevel"]=Authentication.GetSecurityLevel((int)Session["UserI
> > D"]);
> > Session["UserName"]=txtUserName.Text;
> > Session["PassChange"]=txtUserName.Text;
> > txtError.Text="";
Server.Transfer(Authentication.GetMainMenu((int)Se ssion["SecurityLevel"]));
> > }
> > catch
> > {
> > Session["UserID"]="";
> > Session["SecurityLevel"]="";
> > Session["UserName"]="";
> > txtError.Text="You have entered incorrect user login credentials, please
> try
> > again";
> > }
> > }
> > }
> > }
> > From there, they get sent to a menu based off of the function called in
> the
> > CheckLogin_Click function. The Auth class is just a class I am using
for
> DB
> > connection items.
> > Depending on who you log in as, you go to a main menu (different menu
> > depending on your credentials). Each menu (right now) is a blank page,
> with
> > the LoginStatusBar user control, giving information as to who they are
> > logged in as. The code for the LoginStatusBar.ascx.cs is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Collections;
> > using System.ComponentModel;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.SessionState;
> > using System.Web.UI;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > /// <summary>
> > /// Summary description for LoginStatusBar.
> > /// </summary>
> > public class LoginStatusBar : System.Web.UI.UserControl
> > {
> > int LogOutFlag=0;
> > HttpContext current = HttpContext.Current;
> > Auth Authenticate = new Auth();
> > protected System.Web.UI.WebControls.Label lblUserName;
> > protected System.Web.UI.WebControls.Button btnLogout;
> > protected System.Web.UI.WebControls.Label lblSecurity;
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > if(LogOutFlag==0)
> > {
> > try
> > {
> > lblUserName.Text="Logged in using: " +
> > current.Session["UserName"].ToString();
> > lblSecurity.Text="Security Level: " +
Authenticate.GetSecurityLevelText((int)current.Ses sion["SecurityLevel"]);
> > }
> > catch
> > {
> > }
> > }
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnLogout_Click(object sender, System.EventArgs e)
> > {
> > LogOutFlag=1;
> > Server.Transfer("../Default.aspx");
> > }
> > }
> > }
> > Up to this point, everything works fine.
> > One of the menus, I created a button and have it using Server.Transfer
to
> > move to a password change page. It again has the same login status bar,
> > however this is where things break. It will produce the 'Logged in
> using:"
> > piece, and that is it. The "Security Level:" piece never shows up. In
> the
> > main page, I created a label to get the session variable, and it
produces
> > nothing. The code for the Password Change.ascx.cs is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > /// <summary>
> > /// Summary description for PasswordChange.
> > /// </summary>
> > public class PasswordChange : System.Web.UI.UserControl
> > {
> > protected System.Web.UI.WebControls.Button btnChangePassword;
> > protected System.Web.UI.WebControls.Label Label4;
> > protected System.Web.UI.WebControls.Label Label3;
> > protected System.Web.UI.WebControls.Label Label2;
> > protected System.Web.UI.WebControls.Label Label1;
> > protected System.Web.UI.WebControls.TextBox txtConfirmPassword;
> > protected System.Web.UI.WebControls.TextBox txtNewPassword;
> > protected System.Web.UI.WebControls.TextBox txtOldPassword;
> > protected System.Web.UI.WebControls.Label lblUserName;
> > protected System.Web.UI.WebControls.CompareValidator vldNewPass;
> > Auth Authenticate = new Auth();
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > lblUserName.Text=Session["UserName"].ToString();
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnChangePassword.Click += new
> > System.EventHandler(this.btnChangePassword_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnChangePassword_Click(object sender, System.EventArgs e)
> > {
> > try
> > {
if((bool)Authenticate.ChangePassword((string)Sessi on["UserName"],txtOldPassw
> > ord.Text,txtNewPassword.Text))
> > {
Server.Transfer(Authenticate.GetMainMenu((int)Sess ion["SecurityLevel"]));
> > }
> > }
> > catch
> > {
> > }
> > }
> > }
> > }
> > If you need any more info, please let me know.
> > Paul
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:estSzvR9DHA.1052@.TK2MSFTNGP12.phx.gbl...
> > > Sure, post the code which reproduces the problem.
> > > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> > > > I should also mention I tried using httpcontext too, same thing...
> > > > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
> > > > news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > > > > i really have no idea. if you can't figure this out, i 'd be happy
> to
> > > look
> > > > > at the code
> > > > > > > > --
> > > > > Regards,
> > > > > Alvin Bruney [ASP.NET MVP]
> > > > > Got tidbits? Get it here...
> > > > > http://tinyurl.com/3he3b
> > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > > > > Thanks for the suggestion! I do have one question though, that
> > being
> > > > the
> > > > > > case, why does it work once, but not once I move on from that
> page?
> > > > > > > > > > Thanks
> > > > > > Paul
> > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
> > message
> > > > > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > > > > you have custom controls on that page? custom controls cannot
> > > directly
> > > > > > > access session, you need to first get a reference to the
session
> > > > object
> > > > > > from
> > > > > > > httpcontext.current.
> > > > > > > > > > > > If that still doesn't work, you will need to put code to
display
> > the
> > > > > > session
> > > > > > > variable in the page load and troubleshoot from there
> > > > > > > > > > > > if(Session["UserName"]!= null)
> > > > > > > Response.Write("<script>alert('" +
> > > Session["UserName"].ToString()
> > > > +
> > > > > > > "')</script>");
> > > > > > > > > > > > should display something
> > > > > > > --
> > > > > > > Regards,
> > > > > > > Alvin Bruney [ASP.NET MVP]
> > > > > > > Got tidbits? Get it here...
> > > > > > > http://tinyurl.com/3he3b
> > > > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > > > > Hello!
> > > > > > > > > > > > > > The session state information in the web.config is as
follows:
> > > > > > > > > > > > > > <sessionState
> > > > > > > > > > > > > > mode="InProc"
> > > > > > > > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > > > > > > > sqlConnectionString="data
> > source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > > > > > > > cookieless="false"
> > > > > > > > > > > > > > timeout="20"
> > > > > > > > > > > > > > />
> > > > > > > > > > > > > > There is no <pages> element in the Web.config. I want to
have
> > the
> > > > > > session
> > > > > > > > variables be available to all of the pages in the project.
> > > > > > > > > > > > > > Most of the variables that are in the session state are
> strings,
> > > so
> > > > I
> > > > > > use
> > > > > > > > (string) to cast them. For example, in the status bar user
> > > control,
> > > > I
> > > > > > > use:
> > > > > > > > lblUserName.Text="Logged in using: " +
> > > > Session["UserName"].ToString();
> > > > > > > > > > > > > > lblSecurity.Text="Security Level: " +
> > > > > > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > > > > > > > The first line accesses the session directly, and uses
> > ToString()
> > > to
> > > > > get
> > > > > > > the
> > > > > > > > info. The second line I am casting it to an integer to
throw
> > into
> > > > the
> > > > > > > > function. The funny thing with these and the status bar is
> once
> > > it
> > > > > logs
> > > > > > > on
> > > > > > > > and takes you to the menu, all of the info is currect,
however
> > if
> > > I
> > > > > move
> > > > > > > > past that, the first line produces 'Logged in using:' and
that
> > is
> > > > it,
> > > > > > > while
> > > > > > > > the second line produces absolutely nothing.
> > > > > > > > > > > > > > Thanks for your help!
> > > > > > > > > > > > > > Paul
> > > > > > > > > > > > > > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > > > > Hi Paul,
> > > > > > > > > > > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything
that
> > > > appears
> > > > > > in
> > > > > > > > these
> > > > > > > > > > fields. Each page has sessions enabled. If you have
any
> > > > > > suggestions,
> > > > > > > > > > PLEASE let me know!
> > > > > > > > > > > > > > > > You mentioned each page had session enabled. Is there a
> chance
> > > the
> > > > > > > > > session is disabled in web.config? What does your
> > <sessionState>
> > > > > > element
> > > > > > > > > look like?
> > > > > > > > > > > > > > > > Also, do you happen to have a <pages> element in
web.config
> > that
> > > > > > > > > disables the session state for certain files?
> > > > > > > > > > > > > > > > Also, how do you cast values you read from the Session
> object?
> > > > > > > > > > > > > > > > --
> > > > > > > > > Milan Negovan
> > > > > > > > > www.AspNetResources.com
> > > > > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Which class are you referring to? I don't see one specifically that isn't,
other than the user controls.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:umJTAh29DHA.2168@.TK2MSFTNGP12.phx.gbl...
> Your class for your webform does not descend from UI page. What's the
reason
> for this?
> Example:
> public class WebForm1 : System.Web.UI.Page
>
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> news:X8WdnRlAxbkKCq7dRVn2iQ@.giganews.com...
> > Sorry for the delay, I have tried posting the project as an attachment,
> > isn't working, so here is the code:
> > Default.aspx has no code, just the login control. Code is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > using System.Web.SessionState;
> > /// <summary>
> > /// Summary description for WebUserControl1.
> > /// </summary>
> > public class WebUserControl1 : System.Web.UI.UserControl
> > {
> > protected System.Web.UI.WebControls.TextBox txtUserName;
> > protected System.Web.UI.WebControls.TextBox txtPassword;
> > protected System.Web.UI.WebControls.Label txtError;
> > protected System.Web.UI.WebControls.Button btnCheckLogin;
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > if(!IsPostBack)
> > {
> > txtError.Text="";
> > Session["UserID"]="";
> > Session["SecurityLevel"]="";
> > Session["UserName"]="";
> > }
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnCheckLogin.Click += new
> > System.EventHandler(this.btnCheckLogin_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnCheckLogin_Click(object sender, System.EventArgs e)
> > {
> > Auth Authentication = new Auth();
> > try
> > {
Session["UserID"]=Authentication.GetUserID(txtUserName.Text,txtPass word.Text
> > );
Session["SecurityLevel"]=Authentication.GetSecurityLevel((int)Session["UserI
> > D"]);
> > Session["UserName"]=txtUserName.Text;
> > Session["PassChange"]=txtUserName.Text;
> > txtError.Text="";
Server.Transfer(Authentication.GetMainMenu((int)Se ssion["SecurityLevel"]));
> > }
> > catch
> > {
> > Session["UserID"]="";
> > Session["SecurityLevel"]="";
> > Session["UserName"]="";
> > txtError.Text="You have entered incorrect user login credentials, please
> try
> > again";
> > }
> > }
> > }
> > }
> > From there, they get sent to a menu based off of the function called in
> the
> > CheckLogin_Click function. The Auth class is just a class I am using
for
> DB
> > connection items.
> > Depending on who you log in as, you go to a main menu (different menu
> > depending on your credentials). Each menu (right now) is a blank page,
> with
> > the LoginStatusBar user control, giving information as to who they are
> > logged in as. The code for the LoginStatusBar.ascx.cs is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Collections;
> > using System.ComponentModel;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.SessionState;
> > using System.Web.UI;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > /// <summary>
> > /// Summary description for LoginStatusBar.
> > /// </summary>
> > public class LoginStatusBar : System.Web.UI.UserControl
> > {
> > int LogOutFlag=0;
> > HttpContext current = HttpContext.Current;
> > Auth Authenticate = new Auth();
> > protected System.Web.UI.WebControls.Label lblUserName;
> > protected System.Web.UI.WebControls.Button btnLogout;
> > protected System.Web.UI.WebControls.Label lblSecurity;
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > if(LogOutFlag==0)
> > {
> > try
> > {
> > lblUserName.Text="Logged in using: " +
> > current.Session["UserName"].ToString();
> > lblSecurity.Text="Security Level: " +
Authenticate.GetSecurityLevelText((int)current.Ses sion["SecurityLevel"]);
> > }
> > catch
> > {
> > }
> > }
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnLogout_Click(object sender, System.EventArgs e)
> > {
> > LogOutFlag=1;
> > Server.Transfer("../Default.aspx");
> > }
> > }
> > }
> > Up to this point, everything works fine.
> > One of the menus, I created a button and have it using Server.Transfer
to
> > move to a password change page. It again has the same login status bar,
> > however this is where things break. It will produce the 'Logged in
> using:"
> > piece, and that is it. The "Security Level:" piece never shows up. In
> the
> > main page, I created a label to get the session variable, and it
produces
> > nothing. The code for the Password Change.ascx.cs is below:
> > namespace BookTrack.UserControls
> > {
> > using System;
> > using System.Data;
> > using System.Drawing;
> > using System.Web;
> > using System.Web.UI.WebControls;
> > using System.Web.UI.HtmlControls;
> > /// <summary>
> > /// Summary description for PasswordChange.
> > /// </summary>
> > public class PasswordChange : System.Web.UI.UserControl
> > {
> > protected System.Web.UI.WebControls.Button btnChangePassword;
> > protected System.Web.UI.WebControls.Label Label4;
> > protected System.Web.UI.WebControls.Label Label3;
> > protected System.Web.UI.WebControls.Label Label2;
> > protected System.Web.UI.WebControls.Label Label1;
> > protected System.Web.UI.WebControls.TextBox txtConfirmPassword;
> > protected System.Web.UI.WebControls.TextBox txtNewPassword;
> > protected System.Web.UI.WebControls.TextBox txtOldPassword;
> > protected System.Web.UI.WebControls.Label lblUserName;
> > protected System.Web.UI.WebControls.CompareValidator vldNewPass;
> > Auth Authenticate = new Auth();
> > private void Page_Load(object sender, System.EventArgs e)
> > {
> > lblUserName.Text=Session["UserName"].ToString();
> > }
> > #region Web Form Designer generated code
> > override protected void OnInit(EventArgs e)
> > {
> > //
> > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > //
> > InitializeComponent();
> > base.OnInit(e);
> > }
> > /// <summary>
> > /// Required method for Designer support - do not modify
> > /// the contents of this method with the code editor.
> > /// </summary>
> > private void InitializeComponent()
> > {
> > this.btnChangePassword.Click += new
> > System.EventHandler(this.btnChangePassword_Click);
> > this.Load += new System.EventHandler(this.Page_Load);
> > }
> > #endregion
> > private void btnChangePassword_Click(object sender, System.EventArgs e)
> > {
> > try
> > {
if((bool)Authenticate.ChangePassword((string)Sessi on["UserName"],txtOldPassw
> > ord.Text,txtNewPassword.Text))
> > {
Server.Transfer(Authenticate.GetMainMenu((int)Sess ion["SecurityLevel"]));
> > }
> > }
> > catch
> > {
> > }
> > }
> > }
> > }
> > If you need any more info, please let me know.
> > Paul
> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > news:estSzvR9DHA.1052@.TK2MSFTNGP12.phx.gbl...
> > > Sure, post the code which reproduces the problem.
> > > > --
> > > Regards,
> > > Alvin Bruney [ASP.NET MVP]
> > > Got tidbits? Get it here...
> > > http://tinyurl.com/3he3b
> > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> > > > I should also mention I tried using httpcontext too, same thing...
> > > > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
message
> > > > news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > > > > i really have no idea. if you can't figure this out, i 'd be happy
> to
> > > look
> > > > > at the code
> > > > > > > > --
> > > > > Regards,
> > > > > Alvin Bruney [ASP.NET MVP]
> > > > > Got tidbits? Get it here...
> > > > > http://tinyurl.com/3he3b
> > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > > > > Thanks for the suggestion! I do have one question though, that
> > being
> > > > the
> > > > > > case, why does it work once, but not once I move on from that
> page?
> > > > > > > > > > Thanks
> > > > > > Paul
> > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
> > message
> > > > > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > > > > you have custom controls on that page? custom controls cannot
> > > directly
> > > > > > > access session, you need to first get a reference to the
session
> > > > object
> > > > > > from
> > > > > > > httpcontext.current.
> > > > > > > > > > > > If that still doesn't work, you will need to put code to
display
> > the
> > > > > > session
> > > > > > > variable in the page load and troubleshoot from there
> > > > > > > > > > > > if(Session["UserName"]!= null)
> > > > > > > Response.Write("<script>alert('" +
> > > Session["UserName"].ToString()
> > > > +
> > > > > > > "')</script>");
> > > > > > > > > > > > should display something
> > > > > > > --
> > > > > > > Regards,
> > > > > > > Alvin Bruney [ASP.NET MVP]
> > > > > > > Got tidbits? Get it here...
> > > > > > > http://tinyurl.com/3he3b
> > > > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > > > > Hello!
> > > > > > > > > > > > > > The session state information in the web.config is as
follows:
> > > > > > > > > > > > > > <sessionState
> > > > > > > > > > > > > > mode="InProc"
> > > > > > > > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > > > > > > > sqlConnectionString="data
> > source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > > > > > > > cookieless="false"
> > > > > > > > > > > > > > timeout="20"
> > > > > > > > > > > > > > />
> > > > > > > > > > > > > > There is no <pages> element in the Web.config. I want to
have
> > the
> > > > > > session
> > > > > > > > variables be available to all of the pages in the project.
> > > > > > > > > > > > > > Most of the variables that are in the session state are
> strings,
> > > so
> > > > I
> > > > > > use
> > > > > > > > (string) to cast them. For example, in the status bar user
> > > control,
> > > > I
> > > > > > > use:
> > > > > > > > lblUserName.Text="Logged in using: " +
> > > > Session["UserName"].ToString();
> > > > > > > > > > > > > > lblSecurity.Text="Security Level: " +
> > > > > > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > > > > > > > The first line accesses the session directly, and uses
> > ToString()
> > > to
> > > > > get
> > > > > > > the
> > > > > > > > info. The second line I am casting it to an integer to
throw
> > into
> > > > the
> > > > > > > > function. The funny thing with these and the status bar is
> once
> > > it
> > > > > logs
> > > > > > > on
> > > > > > > > and takes you to the menu, all of the info is currect,
however
> > if
> > > I
> > > > > move
> > > > > > > > past that, the first line produces 'Logged in using:' and
that
> > is
> > > > it,
> > > > > > > while
> > > > > > > > the second line produces absolutely nothing.
> > > > > > > > > > > > > > Thanks for your help!
> > > > > > > > > > > > > > Paul
> > > > > > > > > > > > > > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > > > > Hi Paul,
> > > > > > > > > > > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything
that
> > > > appears
> > > > > > in
> > > > > > > > these
> > > > > > > > > > fields. Each page has sessions enabled. If you have
any
> > > > > > suggestions,
> > > > > > > > > > PLEASE let me know!
> > > > > > > > > > > > > > > > You mentioned each page had session enabled. Is there a
> chance
> > > the
> > > > > > > > > session is disabled in web.config? What does your
> > <sessionState>
> > > > > > element
> > > > > > > > > look like?
> > > > > > > > > > > > > > > > Also, do you happen to have a <pages> element in
web.config
> > that
> > > > > > > > > disables the session state for certain files?
> > > > > > > > > > > > > > > > Also, how do you cast values you read from the Session
> object?
> > > > > > > > > > > > > > > > --
> > > > > > > > > Milan Negovan
> > > > > > > > > www.AspNetResources.com
> > > > > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
I spent a great deal of time just trying to get the example to compile with
all the missing undefined classes which really didn't help.

Please provide a short but complete program which demonstrates the problem
according to jons instructions here
http://www.yoda.arachsys.com/csharp/complete.html

Short but complete means I want to paste it into my ide and have it compile
so that i can spend 20 minutes on the bug, and not 20 minutes trying to get
it to compile.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:McqdnUwP8cGQCajdRVn2sg@.giganews.com...
> Which class are you referring to? I don't see one specifically that
isn't,
> other than the user controls.
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:umJTAh29DHA.2168@.TK2MSFTNGP12.phx.gbl...
> > Your class for your webform does not descend from UI page. What's the
> reason
> > for this?
> > Example:
> > public class WebForm1 : System.Web.UI.Page
> > --
> > Regards,
> > Alvin Bruney [ASP.NET MVP]
> > Got tidbits? Get it here...
> > http://tinyurl.com/3he3b
> > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > news:X8WdnRlAxbkKCq7dRVn2iQ@.giganews.com...
> > > Sorry for the delay, I have tried posting the project as an
attachment,
> > > isn't working, so here is the code:
> > > > Default.aspx has no code, just the login control. Code is below:
> > > > namespace BookTrack.UserControls
> > > > {
> > > > using System;
> > > > using System.Data;
> > > > using System.Drawing;
> > > > using System.Web;
> > > > using System.Web.UI.WebControls;
> > > > using System.Web.UI.HtmlControls;
> > > > using System.Web.SessionState;
> > > > /// <summary>
> > > > /// Summary description for WebUserControl1.
> > > > /// </summary>
> > > > public class WebUserControl1 : System.Web.UI.UserControl
> > > > {
> > > > protected System.Web.UI.WebControls.TextBox txtUserName;
> > > > protected System.Web.UI.WebControls.TextBox txtPassword;
> > > > protected System.Web.UI.WebControls.Label txtError;
> > > > protected System.Web.UI.WebControls.Button btnCheckLogin;
> > > > private void Page_Load(object sender, System.EventArgs e)
> > > > {
> > > > if(!IsPostBack)
> > > > {
> > > > txtError.Text="";
> > > > Session["UserID"]="";
> > > > Session["SecurityLevel"]="";
> > > > Session["UserName"]="";
> > > > }
> > > > }
> > > > #region Web Form Designer generated code
> > > > override protected void OnInit(EventArgs e)
> > > > {
> > > > //
> > > > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > > > //
> > > > InitializeComponent();
> > > > base.OnInit(e);
> > > > }
> > > > > /// <summary>
> > > > /// Required method for Designer support - do not modify
> > > > /// the contents of this method with the code editor.
> > > > /// </summary>
> > > > private void InitializeComponent()
> > > > {
> > > > this.btnCheckLogin.Click += new
> > > System.EventHandler(this.btnCheckLogin_Click);
> > > > this.Load += new System.EventHandler(this.Page_Load);
> > > > }
> > > > #endregion
> > > > private void btnCheckLogin_Click(object sender, System.EventArgs e)
> > > > {
> > > > Auth Authentication = new Auth();
> > > > try
> > > > {
> > Session["UserID"]=Authentication.GetUserID(txtUserName.Text,txtPass word.Text
> > > );
> > Session["SecurityLevel"]=Authentication.GetSecurityLevel((int)Session["UserI
> > > D"]);
> > > > Session["UserName"]=txtUserName.Text;
> > > > Session["PassChange"]=txtUserName.Text;
> > > > txtError.Text="";
> > Server.Transfer(Authentication.GetMainMenu((int)Se ssion["SecurityLevel"]));
> > > > }
> > > > catch
> > > > {
> > > > Session["UserID"]="";
> > > > Session["SecurityLevel"]="";
> > > > Session["UserName"]="";
> > > > txtError.Text="You have entered incorrect user login credentials,
please
> > try
> > > again";
> > > > }
> > > > }
> > > > }
> > > > }
> > > > > > From there, they get sent to a menu based off of the function called
in
> > the
> > > CheckLogin_Click function. The Auth class is just a class I am using
> for
> > DB
> > > connection items.
> > > > Depending on who you log in as, you go to a main menu (different menu
> > > depending on your credentials). Each menu (right now) is a blank
page,
> > with
> > > the LoginStatusBar user control, giving information as to who they are
> > > logged in as. The code for the LoginStatusBar.ascx.cs is below:
> > > > namespace BookTrack.UserControls
> > > > {
> > > > using System;
> > > > using System.Collections;
> > > > using System.ComponentModel;
> > > > using System.Data;
> > > > using System.Drawing;
> > > > using System.Web;
> > > > using System.Web.SessionState;
> > > > using System.Web.UI;
> > > > using System.Web.UI.WebControls;
> > > > using System.Web.UI.HtmlControls;
> > > > /// <summary>
> > > > /// Summary description for LoginStatusBar.
> > > > /// </summary>
> > > > public class LoginStatusBar : System.Web.UI.UserControl
> > > > {
> > > > int LogOutFlag=0;
> > > > HttpContext current = HttpContext.Current;
> > > > Auth Authenticate = new Auth();
> > > > protected System.Web.UI.WebControls.Label lblUserName;
> > > > protected System.Web.UI.WebControls.Button btnLogout;
> > > > protected System.Web.UI.WebControls.Label lblSecurity;
> > > > private void Page_Load(object sender, System.EventArgs e)
> > > > {
> > > > if(LogOutFlag==0)
> > > > {
> > > > try
> > > > {
> > > > lblUserName.Text="Logged in using: " +
> > > current.Session["UserName"].ToString();
> > > > lblSecurity.Text="Security Level: " +
> > Authenticate.GetSecurityLevelText((int)current.Ses sion["SecurityLevel"]);
> > > > }
> > > > catch
> > > > {
> > > > }
> > > > }
> > > > }
> > > > #region Web Form Designer generated code
> > > > override protected void OnInit(EventArgs e)
> > > > {
> > > > //
> > > > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > > > //
> > > > InitializeComponent();
> > > > base.OnInit(e);
> > > > }
> > > > > /// <summary>
> > > > /// Required method for Designer support - do not modify
> > > > /// the contents of this method with the code editor.
> > > > /// </summary>
> > > > private void InitializeComponent()
> > > > {
> > > > this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
> > > > this.Load += new System.EventHandler(this.Page_Load);
> > > > }
> > > > #endregion
> > > > private void btnLogout_Click(object sender, System.EventArgs e)
> > > > {
> > > > LogOutFlag=1;
> > > > Server.Transfer("../Default.aspx");
> > > > > > }
> > > > }
> > > > }
> > > > Up to this point, everything works fine.
> > > > One of the menus, I created a button and have it using Server.Transfer
> to
> > > move to a password change page. It again has the same login status
bar,
> > > however this is where things break. It will produce the 'Logged in
> > using:"
> > > piece, and that is it. The "Security Level:" piece never shows up.
In
> > the
> > > main page, I created a label to get the session variable, and it
> produces
> > > nothing. The code for the Password Change.ascx.cs is below:
> > > > > > namespace BookTrack.UserControls
> > > > {
> > > > using System;
> > > > using System.Data;
> > > > using System.Drawing;
> > > > using System.Web;
> > > > using System.Web.UI.WebControls;
> > > > using System.Web.UI.HtmlControls;
> > > > /// <summary>
> > > > /// Summary description for PasswordChange.
> > > > /// </summary>
> > > > public class PasswordChange : System.Web.UI.UserControl
> > > > {
> > > > protected System.Web.UI.WebControls.Button btnChangePassword;
> > > > protected System.Web.UI.WebControls.Label Label4;
> > > > protected System.Web.UI.WebControls.Label Label3;
> > > > protected System.Web.UI.WebControls.Label Label2;
> > > > protected System.Web.UI.WebControls.Label Label1;
> > > > protected System.Web.UI.WebControls.TextBox txtConfirmPassword;
> > > > protected System.Web.UI.WebControls.TextBox txtNewPassword;
> > > > protected System.Web.UI.WebControls.TextBox txtOldPassword;
> > > > protected System.Web.UI.WebControls.Label lblUserName;
> > > > protected System.Web.UI.WebControls.CompareValidator vldNewPass;
> > > > Auth Authenticate = new Auth();
> > > > private void Page_Load(object sender, System.EventArgs e)
> > > > {
> > > > lblUserName.Text=Session["UserName"].ToString();
> > > > }
> > > > #region Web Form Designer generated code
> > > > override protected void OnInit(EventArgs e)
> > > > {
> > > > //
> > > > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
> > > > //
> > > > InitializeComponent();
> > > > base.OnInit(e);
> > > > }
> > > > > /// <summary>
> > > > /// Required method for Designer support - do not modify
> > > > /// the contents of this method with the code editor.
> > > > /// </summary>
> > > > private void InitializeComponent()
> > > > {
> > > > this.btnChangePassword.Click += new
> > > System.EventHandler(this.btnChangePassword_Click);
> > > > this.Load += new System.EventHandler(this.Page_Load);
> > > > }
> > > > #endregion
> > > > private void btnChangePassword_Click(object sender, System.EventArgs
e)
> > > > {
> > > > try
> > > > {
> > if((bool)Authenticate.ChangePassword((string)Sessi on["UserName"],txtOldPassw
> > > ord.Text,txtNewPassword.Text))
> > > > {
> > > Server.Transfer(Authenticate.GetMainMenu((int)Sess ion["SecurityLevel"]));
> > > > }
> > > > }
> > > > catch
> > > > {
> > > > }
> > > > > }
> > > > }
> > > > }
> > > > > > If you need any more info, please let me know.
> > > > > > Paul
> > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> > > news:estSzvR9DHA.1052@.TK2MSFTNGP12.phx.gbl...
> > > > Sure, post the code which reproduces the problem.
> > > > > > --
> > > > Regards,
> > > > Alvin Bruney [ASP.NET MVP]
> > > > Got tidbits? Get it here...
> > > > http://tinyurl.com/3he3b
> > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > news:GpWdnaUxEeF1O6zdRVn2ug@.giganews.com...
> > > > > I should also mention I tried using httpcontext too, same thing...
> > > > > > > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
> message
> > > > > news:OnsMrlQ9DHA.2752@.TK2MSFTNGP09.phx.gbl...
> > > > > > i really have no idea. if you can't figure this out, i 'd be
happy
> > to
> > > > look
> > > > > > at the code
> > > > > > > > > > --
> > > > > > Regards,
> > > > > > Alvin Bruney [ASP.NET MVP]
> > > > > > Got tidbits? Get it here...
> > > > > > http://tinyurl.com/3he3b
> > > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > > news:AeGdnc59Hefb96zdRVn2vw@.giganews.com...
> > > > > > > Thanks for the suggestion! I do have one question though,
that
> > > being
> > > > > the
> > > > > > > case, why does it work once, but not once I move on from that
> > page?
> > > > > > > > > > > > Thanks
> > > > > > > Paul
> > > > > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
> > > message
> > > > > > > news:ew0jZOE9DHA.2832@.tk2msftngp13.phx.gbl...
> > > > > > > > you have custom controls on that page? custom controls
cannot
> > > > directly
> > > > > > > > access session, you need to first get a reference to the
> session
> > > > > object
> > > > > > > from
> > > > > > > > httpcontext.current.
> > > > > > > > > > > > > > If that still doesn't work, you will need to put code to
> display
> > > the
> > > > > > > session
> > > > > > > > variable in the page load and troubleshoot from there
> > > > > > > > > > > > > > if(Session["UserName"]!= null)
> > > > > > > > Response.Write("<script>alert('" +
> > > > Session["UserName"].ToString()
> > > > > +
> > > > > > > > "')</script>");
> > > > > > > > > > > > > > should display something
> > > > > > > > --
> > > > > > > > Regards,
> > > > > > > > Alvin Bruney [ASP.NET MVP]
> > > > > > > > Got tidbits? Get it here...
> > > > > > > > http://tinyurl.com/3he3b
> > > > > > > > "Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
> > > > > > > > news:-sudnUOIdbqWgq3dRVn2sg@.giganews.com...
> > > > > > > > > Hello!
> > > > > > > > > > > > > > > > The session state information in the web.config is as
> follows:
> > > > > > > > > > > > > > > > <sessionState
> > > > > > > > > > > > > > > > mode="InProc"
> > > > > > > > > > > > > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > > > > > > > > > > > > > sqlConnectionString="data
> > > source=127.0.0.1;Trusted_Connection=yes"
> > > > > > > > > > > > > > > > cookieless="false"
> > > > > > > > > > > > > > > > timeout="20"
> > > > > > > > > > > > > > > > />
> > > > > > > > > > > > > > > > There is no <pages> element in the Web.config. I want to
> have
> > > the
> > > > > > > session
> > > > > > > > > variables be available to all of the pages in the project.
> > > > > > > > > > > > > > > > Most of the variables that are in the session state are
> > strings,
> > > > so
> > > > > I
> > > > > > > use
> > > > > > > > > (string) to cast them. For example, in the status bar
user
> > > > control,
> > > > > I
> > > > > > > > use:
> > > > > > > > > lblUserName.Text="Logged in using: " +
> > > > > Session["UserName"].ToString();
> > > > > > > > > > > > > > > > lblSecurity.Text="Security Level: " +
> > > > > > > > > > Authenticate.GetSecurityLevelText((int)Session["SecurityLevel"]);
> > > > > > > > > > > > > > > > The first line accesses the session directly, and uses
> > > ToString()
> > > > to
> > > > > > get
> > > > > > > > the
> > > > > > > > > info. The second line I am casting it to an integer to
> throw
> > > into
> > > > > the
> > > > > > > > > function. The funny thing with these and the status bar
is
> > once
> > > > it
> > > > > > logs
> > > > > > > > on
> > > > > > > > > and takes you to the menu, all of the info is currect,
> however
> > > if
> > > > I
> > > > > > move
> > > > > > > > > past that, the first line produces 'Logged in using:' and
> that
> > > is
> > > > > it,
> > > > > > > > while
> > > > > > > > > the second line produces absolutely nothing.
> > > > > > > > > > > > > > > > Thanks for your help!
> > > > > > > > > > > > > > > > Paul
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "Milan Negovan" <santa@.northpole.net> wrote in message
> > > > > > > > > news:TXSXb.10685$cE3.17376713@.news4.srv.hcvlny.cv. net...
> > > > > > > > > > Hi Paul,
> > > > > > > > > > > > > > > > > > > > > > > > > > > I don't receive any errors, there just isn't anything
> that
> > > > > appears
> > > > > > > in
> > > > > > > > > these
> > > > > > > > > > > fields. Each page has sessions enabled. If you have
> any
> > > > > > > suggestions,
> > > > > > > > > > > PLEASE let me know!
> > > > > > > > > > > > > > > > > > You mentioned each page had session enabled. Is there a
> > chance
> > > > the
> > > > > > > > > > session is disabled in web.config? What does your
> > > <sessionState>
> > > > > > > element
> > > > > > > > > > look like?
> > > > > > > > > > > > > > > > > > Also, do you happen to have a <pages> element in
> web.config
> > > that
> > > > > > > > > > disables the session state for certain files?
> > > > > > > > > > > > > > > > > > Also, how do you cast values you read from the Session
> > object?
> > > > > > > > > > > > > > > > > > --
> > > > > > > > > > Milan Negovan
> > > > > > > > > > www.AspNetResources.com
> > > > > > > > > > Essential recources for ASP.NET developers
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Ok, got the issue figued out!

On my main page, I have a login control that will set the session variables,
and should something go wrong (cannot connect to the database, nothing is
returned when trying to verify the user ID or security level, etc), it will
then set the variables blank.

The odd part is that part 'seemed' to work, as when you log in it takes you
to the next page and everything is fine. From there though, no matter what
page you went to, it stopped working.

I commented out the lines to blank out the session variables in the control
presented on the first page, and everything is working now! Why that
affected it, I am not sure yet, but it did. I guess the lesson is to be
careful of what you are doing as even though things seem to work, they can
burn you down the road!

Thanks everyone for your help on this! Greatly appreciated!

Paul
"Paul Yanzick" <yanzickp@.hotmail.com> wrote in message
news:AtydnaT3lcQobbLdRVn2sg@.giganews.com...
> Hello,
> I am trying to develop a book tracking application for my capstone in
> school, and am running into a problem.
> The application is an ASP.Net application written in C#. The first page
you
> go to is a login form, which will set several session variables with the
> name used to log in, appropriate security level and some other misc
> variables, and then will go to a main menu for each particular security
> level using Server.Transfer. Each main menu contains a user control at
the
> top showing the security level you are logged in as and the username that
> you are logged in as.
> From here, if I try to utilize a menu item (either hyperlink or a button
> that uses Server.Transfer again) to go to a different page, the session
> variables no longer seem to exist. For example, one such page goes to a
> password change page, and also includes the same user control that the
main
> menu has at the top, however it doesn't list the information in the
session
> variables. In fact, it only shows part of the textual part as well. The
> actual page itself uses another user control (basically a table with a few
> fields on it) that calls a session variable, and that one doesn't show up
> either.
> I don't receive any errors, there just isn't anything that appears in
these
> fields. Each page has sessions enabled. If you have any suggestions,
> PLEASE let me know!
> If you would like to see what happens, take a look at
> http://www.st-onge.org/class/dev/booktrack/default.aspx and use
> tadmin/tadmin for the username/password. Right now the menu contains just
a
> button that is unlabeled, but that takes you to the password change
utility.
> Thanks in advance,
> Paul