Pass a Session Variable from ASP.NET to ASP

W

Wayne Wengert

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
 
S

Scott M.

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.
 
W

Wayne Wengert

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
 
S

Scott M.

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
 
Joined
May 28, 2008
Messages
11
Reaction score
0
thanks

thanx a lottttttttt!
some times i thought.why i waste my time to find solution of my problemson other sites.when every time i found solution on velocity.

thanks again



Wayne Wengert said:
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." <[email protected]> wrote in message
news:[email protected]...
> 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" <[email protected]> wrote in message
> news:[email protected]...
> > 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
> >
> >

>
>
 
Joined
May 28, 2008
Messages
11
Reaction score
0
i hav i html page .i want to forward that page to my friends as a link with email.that reciever click on link and reach on that page. how do i do this.i want to make this page in asp.net2003 using c#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top