I have a vb.net project and c#.net project . How can I pass a session variable to c#.net project upon button click of a vb.net project. I am publishing c#.net project and accessing through button click of vb.net project.
I have a vb.net project and c#.net project . How can I pass a session variable to c#.net project upon button click of a vb.net project. I am publishing c#.net project and accessing through button click of vb.net project.
Normally, a session variable in VB.net projects cannot be passed to C #.
Unless the vb.net project has a reference for the C# project, we could get the session in the C# project by HttpContext.
Best regards,
Sam
IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Summary is that you need to user SQL server as session state provider and you get the session values in both application.
Another solution is from you project 1 you can pass query string value or post value to project 2 and you will get the values because its standard approach to share data, you can secure data by encryption.
Member
186 Points
406 Posts
Button click in vb.net
Dec 11, 2019 01:00 AM|shsu|LINK
I have a vb.net project and c#.net project . How can I pass a session variable to c#.net project upon button click of a vb.net project. I am publishing c#.net project and accessing through button click of vb.net project.
using below code in the button click
Dim MO As String = Session("zzz")
Response.Redirect(String.Format("http://11.11.1.1/Order/add.aspx?{0}", MO))
Thanks
Contributor
3370 Points
1409 Posts
Re: Button click in vb.net
Dec 11, 2019 06:31 AM|samwu|LINK
Hi shsu,
Normally, a session variable in VB.net projects cannot be passed to C #.
Unless the vb.net project has a reference for the C# project, we could get the session in the C# project by HttpContext.
Best regards,
Sam
Contributor
3150 Points
953 Posts
Re: Button click in vb.net
Dec 11, 2019 10:40 AM|sanjibsinha|LINK
To read the session value on your C# page, you can try something like this:
string sessionValue = Request.Form["key"];
Contributor
2096 Points
1040 Posts
Re: Button click in vb.net
Dec 12, 2019 11:30 AM|Khuram.Shahzad|LINK
if both applications are in ASP.Net web app then you can share the session.
https://www.codeproject.com/Questions/633747/Sharing-session-value-between-two-different-asp-ne
Summary is that you need to user SQL server as session state provider and you get the session values in both application.
Another solution is from you project 1 you can pass query string value or post value to project 2 and you will get the values because its standard approach to share data, you can secure data by encryption.