Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 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
  #1 (permalink)  
Old March 8th, 2006, 07:47 AM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Session Variables

Hi folks,

Nice and easy question now. I need to create two session variables that will store the username and password of a user, and these session variables need to be accessed globaly from 6 other web applications running on the same box.

I am using Visual Studio 2005, with VB, and running Win2k3 Server with IIS6.

Anyone got any ideas/code exmaples please send them this way.

THANKS!!

  #2 (permalink)  
Old March 8th, 2006, 02:31 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You won't be able to do that directly with .NET.

In each session store (e.g. in proc, state server and SQL Server), .NET keeps track of the app that stores the state. Only for that app will the session variables be returned.

However, Session state is a provider model too, so you could write your own session state provider and plug it into the applications. The provider code would then access a data store and return the data for each of the applications.

Not an easy undertaking.... Why do you need this? There may be better or easier ways to accomplish something like this...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Lady Of The Flowers by Placebo (Track 9 from the album: Placebo) What's This?
  #3 (permalink)  
Old March 8th, 2006, 03:36 PM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar again ;)

Basically I am using two session variables to store a username and password from a login screen, to plug directly into the data connections i have throughout my web application. Now this is working without a problem but as soon as i reference a different web application which the username and password need to be plugged into the data connection it handles it as a new session so clears both of the session variables I set.

Now luckerly I have managed to sort this out by not using session variables but by using a temp cookie to store the two variables in and it seems to be working ok.

  #4 (permalink)  
Old March 8th, 2006, 03:40 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Great, although storing a user name and a password as clear text in a cookie seems like an insecure solution to me....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: My Gift To You by KoRn (Track 14 from the album: Follow The Leader) What's This?
  #5 (permalink)  
Old March 8th, 2006, 03:47 PM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you have another solution which would secure it a little better?

  #6 (permalink)  
Old March 8th, 2006, 03:49 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Is there a reason why you're not using the built-in ASP.NET authentication? That's more secure, and a lot easier to implement (just enable it).

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: 5 Years by Björk (Track 6 from the album: Homogenic) What's This?
  #7 (permalink)  
Old March 8th, 2006, 04:09 PM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

???

Didnt know it has, do you have any documentation???

  #8 (permalink)  
Old March 8th, 2006, 04:25 PM
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From looking at what I have founf on the net, its only for Windows and Passport authentication. Although look at the Form authentication seems interesting. Not too sure who I would implement this as the user accounts I use or AS400 accounts (UNIX).

  #9 (permalink)  
Old March 8th, 2006, 04:26 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This is a nice start:

http://www.asp.net/QuickStart/aspnet...y/default.aspx

After the introduction, there are like a billion other articles out on the internet that can help you further.

The Quick Start should be enough to whet your appetite and give you enough "names" and other concepts to search...

ASP.NET 2.0 contains a lot of functionality out-of-the box: Login controls, CreateUserWizard, PasswordRecovery and so on.... I am sure you'll like it.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The Witness Song by Nick Cave & the Bad Seeds (Track 8 from the album: The Good Son) What's This?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Variables in C# shikha09 C# 1 November 28th, 2006 10:38 AM
Is it possible for me using session variables into see07 ASP.NET 1.x and 2.0 Application Design 4 March 9th, 2005 07:46 PM
Session Variables - help? Annoyamouse BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 11 August 31st, 2004 03:56 PM
Session Variables flesh_god Dreamweaver (all versions) 7 November 11th, 2003 05:52 PM
session variables help face Classic ASP Databases 4 September 12th, 2003 03:57 PM





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