Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2004, 12:00 AM
Registered User
 
Join Date: Nov 2004
Location: Quezon City, NCR, Philippines.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass session vars from C# to VB.Net

Hi,

  I would like to know how you can pass a session variable from an ASP.Net page coded in C# to another ASP.Net page coded in VB.Net. Is this possible without having to write out a temporary file? Answers are much appreciated. Thanks.



 
Old November 11th, 2004, 09:48 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You don't have to do anything special. ASP.NET pages running in the same application scope share the session collection.

C#:
Session["key"] = value;

VB:
value = Session("key")
 
Old November 11th, 2004, 08:44 PM
Registered User
 
Join Date: Nov 2004
Location: Quezon City, NCR, Philippines.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, thank you. I will try out a sample page based on what you posted. Thanks.

 
Old November 11th, 2004, 08:51 PM
Registered User
 
Join Date: Nov 2004
Location: Quezon City, NCR, Philippines.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh just another curiosity...how about if they don't share the same application scope? Will it still be possible and as simple as that? Thanks for being patient.

 
Old November 11th, 2004, 10:43 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Multiple applications do not share session data. If you need to share data you'll need to pass it by a querystring or thru some persistant data store like a database. Or perhaps you need to merge applications if they are related.
 
Old November 11th, 2004, 11:43 PM
Registered User
 
Join Date: Nov 2004
Location: Quezon City, NCR, Philippines.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok. i had hoped they could but anyway, database would do since I want to keep the data hidden from users. Thanks again planoie!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert New Row from Session Vars iceandrews VB Databases Basics 1 May 12th, 2008 08:16 AM
Security: Could someone falsificate session vars? Maxxim ASP.NET 2.0 Professional 5 February 13th, 2008 12:06 PM
how to pass sql query to crystal through vb.net dranjithreddy Crystal Reports 0 June 7th, 2005 05:15 AM
How can I pass sql query through vb.net to crystal sachinbashetti Crystal Reports 0 May 14th, 2005 01:47 AM
Why is it bad to put Objects into Session Vars? treycarroll Beginning PHP 3 August 18th, 2003 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.