471,850 Members | 1,233 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,850 software developers and data experts.

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 5046
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
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.