locked
Button click in vb.net RRS feed

  • Question

  • User-1578974752 posted

    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

    Wednesday, December 11, 2019 1:00 AM

All replies

  • User288213138 posted

    Hi shsu,

    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

    Wednesday, December 11, 2019 6:31 AM
  • User-1340885213 posted

    To read the session value on your C# page, you can try something like this:

    string sessionValue = Request.Form["key"];

    Wednesday, December 11, 2019 10:40 AM
  • User-1780421697 posted

    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.

    Thursday, December 12, 2019 11:30 AM