473,770 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5163
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******** *****@tk2msftng p13.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:HyperLin k id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?n ame=" +
DataBinder.Eval (Container.Data Item,"JudgeName ") + "&caption=" +
DataBinder.Eval (Container.Data Item,"Caption") %>'
Text = "Edit" >
</asp:HyperLink>

I'd like to add something like this

<asp:HyperLin k id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?n ame=" +
DataBinder.Eval (Container.Data Item,"JudgeName ") + "&caption=" +
DataBinder.Eval (Container.Data Item,"Caption") + "&userid=" +
Session("Active User") %>'
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******** ******@TK2MSFTN GP11.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******** *****@tk2msftng p13.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?n ame=" + "JudgeName"
+ "&caption=" + "Caption"
End Sub
"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:OR******** ******@TK2MSFTN GP12.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:HyperLin k id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?n ame=" +
DataBinder.Eval (Container.Data Item,"JudgeName ") + "&caption=" +
DataBinder.Eval (Container.Data Item,"Caption") %>'
Text = "Edit" >
</asp:HyperLink>

I'd like to add something like this

<asp:HyperLin k id="XX" runat="server"
NavigateUrl = '<%#
"http://wengert.org/evaljudge.asp?n ame=" +
DataBinder.Eval (Container.Data Item,"JudgeName ") + "&caption=" +
DataBinder.Eval (Container.Data Item,"Caption") + "&userid=" +
Session("Active User") %>'
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******** ******@TK2MSFTN GP11.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******** *****@tk2msftng p13.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
11589
by: Gerhard Pretorius | last post by:
ON Win 2003 IIS6, Since yesterday, (12 Aug 2003) for some strange reason, (after installing WindowsServer2003-KB823980-x86-ENU.exe) I cannot pass the Request object to to VB COM DLL. I have a funciton inVB DLL Function BuildSqlWhereFromHTML(ByRef AspReq As ASPTypeLibrary.Request, _ ByRef AspSes As ASPTypeLibrary.Session) As String
5
2333
by: eagletender | last post by:
I am simply trying to pass a variable to another page. I know my second page can do Request("str") to retrieve that variable, but how do I pass it in the first place? I tried Server.Execute("P2.asp?str="hello") but I get errors. I tried Response.Redirect("P2.asp?str="hello") but the variable is empty I tried setting variables like you would in VB: str="hello" Server.Execute("P2.asp")
3
2213
by: Kelvin | last post by:
Hi All, Please help. How to pass traditional asp session variable to C# session variable ?? Please advise. Thanks
1
4639
by: crjunk | last post by:
I've got an aspx page that allows the user to select different options whenever they want to run a report. On this page, I have added an additional text box for the user to enter in comments about the report they are running. I would like to be able to have the comments that the user has entered to appear on the report that is generated. I thought that I might be able to pass this text to the report by using a session variable but I...
3
807
by: Wayne Wengert | last post by:
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
4
1289
by: acool | last post by:
I want the ability to fill in the public properties of a given class in a webform pump that class into a session variable and then recreate a new instance of that class in order to grab those same properties. The only thing that has me stumped is how to grab the appropriate session object in order to grab th right class. Can this be done or is there a better way to do this?
17
7075
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the returned value is "" Anybody know how to set this value on 1st page properly, in order to let 2nd page catch it? I don't want to use querystring to pass this value!
4
2656
by: simon | last post by:
hello. relatively new to vb.net, i'm using VS 2003 and .net 2.0 i have a web app that i'm i have a user control that displays a simple 1 row table as the header of the page. the user control takes one input variable, the string that will be displayed as the title of the page. example call: <uc1:Header runat=server ID="ucHeader" Title="Home Page" /> what i am looking to do on a certain page is have the "title" value be dynamic, in...
1
1503
by: aperez | last post by:
Hi, I need to pass a session variable from an ASP.NET v1.1 page to a v2.0 page, but haven't been able to do it. The reason is because I need to embed the 1.1 page in my intranet portal tool so I can ask it the user id that is currently logged in (using Plumtree, .. I mean BEA). The portal only supports v1.1. I want to pass that session variable to multiple pages externally that are running v2.0. Is this possible? Please help.
3
4766
by: hon123456 | last post by:
Dear all, I have a session variable session("loginid) which can be passed from A.asp to B.asp. Then In B.asp I have a hyperlink to C.asp e.g. < A href..C.asp>. The session variable cannot be passed to C.asp. The session variable is empty. What can I do to debug this problem? Thanks
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.