Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7994149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:03:36+00:00 2026-06-04T14:03:36+00:00

I am trying to pass a vbscript session variable to my c# page. Upon

  • 0

I am trying to pass a vbscript session variable to my c# page.
Upon research I found this page:

Transfer Session Variables from Classic ASP to ASP.NET

I don’t know how to change my

Int32 intresortID = Convert.ToInt32(Request.QueryString["TypeID"]);

to read in the session variable in the same manner as from the code provided in the link above(pasted below:)

 <TITLE>ASPNETPage1.aspx</TITLE>
<%@ Page language="c#" %>
<script runat=server>
// We iterate through the Form collection and assign the names and values
// to ASP.NET session variables! We have another Session Variable, "DestPage"
// that tells us where to go after taking care of our business...
private void Page_Load(object sender, System.EventArgs e)
{
for(int i=0;i<Request.Form.Count;i++)
{
Session[Request.Form.GetKey(i)]=Request.Form[i].ToString();
}
Server.Transfer(Session["DestPage"].ToString(),true);
}
</script>

==============================================================================

<TITLE>FinalPage.aspx</TITLE>
<%@ Page language="c#" %>
<script runat=server>
// This page is just a "proof of concept page"...

private void Page_Load(object sender, System.EventArgs e)
{ 
Response.Write("Shared Session Variable Names/Values between Classic ASP and ASP.NET:<BR>");
for (int i = 0; i < Session.Contents.Count; i++) 
{ 
Response.Write("Assigned to \"" +Session.Keys[i].ToString()+"\"");  
Response.Write(" Value: "+ Session[i].ToString() +"<BR>");
} 
}
</script>

Update:
Code for where session variable is called on C# page:

 private void FillGrid()
        {
            string connStr = ConfigurationManager.ConnectionStrings["bdsConnectionString"].ConnectionString;
            using (SqlConnection Con = new SqlConnection(connStr))
            {
                Con.Open();
                Int32 intresortID = Convert.ToInt32(Request.Form["TypeID"]);
                Label4.Text = Convert.ToString(intresortID);
                Label4.Visible = true;
                DateTime startdate;
                startdate = Convert.ToDateTime(TextBox1.Text);

                Int32 ed = Convert.ToInt32(TextBox2.Text);
                DateTime enddate;
                enddate = startdate.AddDays(ed);

                string str = "SELECT TOP (100) PERCENT tblAvail.dtm as Dtm, tblResortsRooms.strRoomType as strRoomType, tblResortsRooms.strDescription as strDescription, tblAvail.intQty as intQty, tblAvail.curPrice as curPrice, tblResortsRooms.intWSCode  as intWSCode FROM tblAvail INNER JOIN tblResortsRooms ON tblAvail.intResortID = tblResortsRooms.intResortID AND tblAvail.strRoomType = tblResortsRooms.strRoomType WHERE (tblResortsRooms.curRecRate > 0) AND (tblAvail.intResortID = @intResortID) and (tblAvail.dtm between @startdate and @enddate) ORDER BY tblResortsRooms.strRoomType";
                SqlDataAdapter sdr = new SqlDataAdapter(str, Con);
                sdr.SelectCommand.Parameters.AddWithValue("@intResortID", intresortID);
                sdr.SelectCommand.Parameters.AddWithValue("@startdate", startdate);
                sdr.SelectCommand.Parameters.AddWithValue("@enddate", enddate);
                DataTable dt = new DataTable();
                sdr.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    GridView1.DataSource = dt;
                    GridView1.DataBind();
                    Button2.Visible = true;
                }




            }

        }

Can somebody please show me how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:03:37+00:00Added an answer on June 4, 2026 at 2:03 pm

    Bottom line is that a session variable in Classical ASP is not available to ASP.Net (regardless of the language used). You will need to make that value available to the ASP.Net page via a query string or form that gets posted back to the ASP.Net page. So a suggested solution is to pass the value (which apparently is in a session variable in the classical ASP page) via a query string to the ASP.Net page. Then on the ASP.Net page retrieve the query string value and do whatever you want with it.

    I hope I haven’t missed the point. But bottom line is there is no interaction between session variables in Classical ASP and ASP.Net because they use completely different frameworks and engines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to pass the variable flickrurl to a PHP page with jQuery/ajax. It works
Im trying to pass some variables from the URL to the PHP script. Now
I am trying to pass a parameter from AJAX back to my JSP page.
Trying to pass some values into an imagebutton click event, something like this: <asp:ImageButton
I'm trying to pass data from one page to another. www.mints.com?name=something How to read
Im trying to pass some values into a text box from a child page
I'm trying to pass some POST variables from hidden inputs (using JQuery to change
I am trying to pass parameters from Visual Studio using VB.net to a Crystal
I'm trying to pass this to a PHP script through AJAX: var answers={}; for
I'm trying pass in a url as a paramter to my controller like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.