Tuesday, March 13, 2012

Session Variables between ASP Classic and ASP .NET

I have a classic ASP application that determines whether a user is logged in by examining a Session Variable, Session("LoginId"). Once logged in there is a link to a new search page (.aspx) this page basicaly allows searcing of the database and selection of users from a DataGrid. When a user in the DataGrid is selected (using hyperlink) you are returned to the .asp page, however the Session("LoginId") is empty and the users then have to log in again ? This happens randomly, i.e. if a user logs in again and repeats the process they stay logged in ?

The .aspx files are in a different Virtual Directory to the .asp files; is there any way that I can persist the Session Variables between apps.

Any help appreciated.
TonySessions are limited to the Application in which they reside.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Tony" <anonymous@.discussions.microsoft.com> wrote in message
news:EB0E5F04-76EF-4AEE-9324-457AD27644BB@.microsoft.com...
> I have a classic ASP application that determines whether a user is logged
in by examining a Session Variable, Session("LoginId"). Once logged in
there is a link to a new search page (.aspx) this page basicaly allows
searcing of the database and selection of users from a DataGrid. When a
user in the DataGrid is selected (using hyperlink) you are returned to the
..asp page, however the Session("LoginId") is empty and the users then have
to log in again ? This happens randomly, i.e. if a user logs in again and
repeats the process they stay logged in ?
> The .aspx files are in a different Virtual Directory to the .asp files; is
there any way that I can persist the Session Variables between apps.
> Any help appreciated.
> Tony
Hi Tony,

The session variables can time out, you can also (better) use the viewstat

(In asp.net)

http://msdn.microsoft.com/library/d...asp11222001.asp

I hope this helps?

Cor

> I have a classic ASP application that determines whether a user is logged
in by examining a Session Variable, Session("LoginId"). Once logged in
there is a link to a new search page (.aspx) this page basicaly allows
searcing of the database and selection of users from a DataGrid. When a
user in the DataGrid is selected (using hyperlink) you are returned to the
..asp page, however the Session("LoginId") is empty and the users then have
to log in again ? This happens randomly, i.e. if a user logs in again and
repeats the process they stay logged in ?
> The .aspx files are in a different Virtual Directory to the .asp files; is
there any way that I can persist the Session Variables between apps.
> Any help appreciated.
> Tony
To help get around the issue I am using intermediate pages to transfer
session variables from asp to asp.net and vice versa. I pass the values
through/via a query string parameter to an intermediate page and then set
the appropriate variable. This is a crappy way to get the two apps to talk,
but it works for now. Also, one drawback is that you are not able to pass
objects (unless you serialize to a hidden textbox or serialize to a query
string and re-populate at the recieving side) from each server application.

"Tony" <anonymous@.discussions.microsoft.com> wrote in message
news:EB0E5F04-76EF-4AEE-9324-457AD27644BB@.microsoft.com...
> I have a classic ASP application that determines whether a user is logged
in by examining a Session Variable, Session("LoginId"). Once logged in
there is a link to a new search page (.aspx) this page basicaly allows
searcing of the database and selection of users from a DataGrid. When a
user in the DataGrid is selected (using hyperlink) you are returned to the
..asp page, however the Session("LoginId") is empty and the users then have
to log in again ? This happens randomly, i.e. if a user logs in again and
repeats the process they stay logged in ?
> The .aspx files are in a different Virtual Directory to the .asp files; is
there any way that I can persist the Session Variables between apps.
> Any help appreciated.
> Tony
To help get around the issue I am using intermediate pages to transfer
session variables from asp to asp.net and vice versa. I pass the values
through/via a query string parameter to an intermediate page and then set
the appropriate variable. This is a crappy way to get the two apps to talk,
but it works for now. Also, one drawback is that you are not able to pass
objects (unless you serialize to a hidden textbox or serialize to a query
string and re-populate at the recieving side) from each server application.

"Tony" <anonymous@.discussions.microsoft.com> wrote in message
news:EB0E5F04-76EF-4AEE-9324-457AD27644BB@.microsoft.com...
> I have a classic ASP application that determines whether a user is logged
in by examining a Session Variable, Session("LoginId"). Once logged in
there is a link to a new search page (.aspx) this page basicaly allows
searcing of the database and selection of users from a DataGrid. When a
user in the DataGrid is selected (using hyperlink) you are returned to the
..asp page, however the Session("LoginId") is empty and the users then have
to log in again ? This happens randomly, i.e. if a user logs in again and
repeats the process they stay logged in ?
> The .aspx files are in a different Virtual Directory to the .asp files; is
there any way that I can persist the Session Variables between apps.
> Any help appreciated.
> Tony

0 comments:

Post a Comment