469,575 Members | 1,190 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Pass a Session Variable from ASP.NET to ASP

I have an application where a session variable is set in an ASPX page, The
process calls an ASP page and when in that page the session variable appears
to be null. How can I pass a session variable to an ASP page?

Wayne
Nov 18 '05 #1
3 4812
You can't directly. ASP and ASP.NET use different engines and do not share
any application or session data. You will have to pass the value manually
in a cookie, querystring, hidden form field, database or file of your own.
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:ux*************@tk2msftngp13.phx.gbl...
I have an application where a session variable is set in an ASPX page, The
process calls an ASP page and when in that page the session variable appears to be null. How can I pass a session variable to an ASP page?

Wayne

Nov 18 '05 #2
Scott;

Thanks for the response. I suspected something like that and I tried to add
the Session value to a querystring but I cannot find the correct syntax. I
have the following code for a hyperlink:

<asp:HyperLink id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption")%>'
Text = "Edit" >
</asp:HyperLink>

I'd like to add something like this

<asp:HyperLink id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption") + "&userid=" +
Session("ActiveUser") %>'
Text = "Edit" >
</asp:HyperLink>

but that doesn't work. How can I add a session variable to that hyperlink?

TIA

Wayne

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
You can't directly. ASP and ASP.NET use different engines and do not share any application or session data. You will have to pass the value manually
in a cookie, querystring, hidden form field, database or file of your own.
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:ux*************@tk2msftngp13.phx.gbl...
I have an application where a session variable is set in an ASPX page, The process calls an ASP page and when in that page the session variable

appears
to be null. How can I pass a session variable to an ASP page?

Wayne


Nov 18 '05 #3
I would take a different approach. Instead of trying to add logic to your
HTML, I would add it to the code-behind (which is the preferred way in
..NET).

Simply place your asp:hyperlink in the aspx page and then in the
code-behind, determine its NavigateURL value

Sub Page_Load()
Dim JudegName as String = GET DATA VALUE
Dim Caption as String = GET DATA VALUE
XX.NavigateURL = "http://wengert.org/evaljudge.asp?name=" + "JudgeName"
+ "&caption=" + "Caption"
End Sub
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...
Scott;

Thanks for the response. I suspected something like that and I tried to add the Session value to a querystring but I cannot find the correct syntax. I
have the following code for a hyperlink:

<asp:HyperLink id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption")%>'
Text = "Edit" >
</asp:HyperLink>

I'd like to add something like this

<asp:HyperLink id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption") + "&userid=" +
Session("ActiveUser") %>'
Text = "Edit" >
</asp:HyperLink>

but that doesn't work. How can I add a session variable to that hyperlink?

TIA

Wayne

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
You can't directly. ASP and ASP.NET use different engines and do not

share
any application or session data. You will have to pass the value manually
in a cookie, querystring, hidden form field, database or file of your own.

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:ux*************@tk2msftngp13.phx.gbl...
I have an application where a session variable is set in an ASPX page,

The process calls an ASP page and when in that page the session variable

appears
to be null. How can I pass a session variable to an ASP page?

Wayne



Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Kelvin | last post: by
1 post views Thread by crjunk | last post: by
3 posts views Thread by Wayne Wengert | last post: by
1 post views Thread by aperez | last post: by
3 posts views Thread by hon123456 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.