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

  • SEARCH
  • Home
  • 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 6840541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:51:25+00:00 2026-05-26T23:51:25+00:00

On page one I would like to create an instance of a class as

  • 0

On page one I would like to create an instance of a class as such:

    pOne = New pClass()
    xOne = New xClass(pOne)

Then on subsequent pages I would like to be able to use pOne and xOne. Since pOne and xOne are local to page one how can I use them in other pages?

  • 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-05-26T23:51:25+00:00Added an answer on May 26, 2026 at 11:51 pm

    You may use Session variable to store that object and use it in another page.

    //Set the session
    Session["p1"]=pOne;
    Session["x1"]=xOne;
    

    in second page, read the session

    if(Session["p1"]!=null)
    {
       // If object is present in session, Cast that to our class (PClass) type
       PClass objP1=(PClass) Session["p1"];  
       //Now you can use objP1
    }
    if(Session["x1"]!=null)
    {
       XClass objx1=(XClass) Session["x1"];  
       //Now you can use objx1 
    }
    

    It is a good practice to always do a null check before accessing a variable

    Here is the VB.NET version ( I hope this works, I don’t have much experience in VB.NET)

     // Set the Session
     Session("p1")=pOne
     Sesssion("x1")=xOne
    

    In second page read the session,

     if Session("p1") IsNot Nothing Then
       Dim objP1 As pClass       
       objP1=CType(Session("p1"),pClass)   
       'Now you can use objP1
     End If
    
     if Session("x1") IsNot Nothing Then
       Dim objX1 As xClass
       objX1=CType(Session("x1"),xClass)
       'Now you can use objX1
     End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make one of the div's hidden while rendring. After page
I would like to create pdfs with ruby. One special need is embedding a
I'm new with jsTree and I would like to create a tree starting from
How would one display any add content from a dynamic aspx page? Currently I
How would I include a page from the public folder in one of my
How does one style links for the current page differently from others? I would
I currently use this style to create a js class like structure: var JSClass
I would like to create a folder that users who do not have privileges
I would like to create the ability for a user to have opened more
I have two forms on a page (one is being grabbed by AJAX). I

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.