473,586 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session State across ASP.NET apps

Ok, I know that .net inherently does not share session data across asp.net
projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net session
object (using state service). I'd like to start breaking out
our functionality into component projects, but I'd like to get this session
issue worked out first.

Any ideas??

I found this article , but it sounds like kind of a pain.

http://www.asp101.com/articles/jayra...te/default.asp

Nov 18 '05 #1
3 3434
Set the encrypt and decrypt key to the same value in each web. Then, set the
authentication cookie name (forms auth) to the same name. This will
authenticate the user once for any number of servers. NOTE: If you farm, you
will have to use the same Session Server for all machine (I have not
personally tested this, however).

For session variables, I have yet to have found a solution. Currently, we
persist session vars in a SQL Server database with a timestamp (cleared out
12 hours later). You can then grab the vars in the other app.

I have a theory that placing the applications in the same pool in IIS might
allow sharing of session vars, but have not tested it. Another possibility
is to set up a web service in each app to pass vars to the other app. Since
the web service would recognize the session ID, it could pass back the info.
NOTE: For high security, you would have to encrypt the data before throwing
into the web service return, as a sniffer could get session IDs and query
your web service. I have not tested this yet, either.

As for the article you link to, you can do what the article suggests without
the massive delete, edit the .webinfo file crap if you set up the parent app
and make the other "apps" subdirs of the parent app (importing, if child
apps already completed). This is really a non-solution for most of us, as
you are essentially killing the child apps and making a single parent app
with all of your applications. You cannot set up the application on a unique
CName, like app1.mydomain.c om, as it is tied to the other apps*. Yuck!

* Actually, there is a way to kludge that too, but also not recommended.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***

"Mark" <ma*****@kc.rr. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Ok, I know that .net inherently does not share session data across asp.net
projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net session
object (using state service). I'd like to start breaking out
our functionality into component projects, but I'd like to get this session issue worked out first.

Any ideas??

I found this article , but it sounds like kind of a pain.

http://www.asp101.com/articles/jayra...te/default.asp


Nov 18 '05 #2
Yeah, we are already using a central (single) state server for all web
servers in our farm, so I knew about the encrypt decrypt thing for that.

I'm just talking about sharing the session between apps. I'm aware of some
of the hacks you mentioned. I guess I'm just looking for a fairly clean
solution, but it doesn't look like that exists.

thanks .

"Cowboy" <No************ @comcast.netNoS pamM> wrote in message
news:uC******** ******@TK2MSFTN GP12.phx.gbl...
Set the encrypt and decrypt key to the same value in each web. Then, set the authentication cookie name (forms auth) to the same name. This will
authenticate the user once for any number of servers. NOTE: If you farm, you will have to use the same Session Server for all machine (I have not
personally tested this, however).

For session variables, I have yet to have found a solution. Currently, we
persist session vars in a SQL Server database with a timestamp (cleared out 12 hours later). You can then grab the vars in the other app.

I have a theory that placing the applications in the same pool in IIS might allow sharing of session vars, but have not tested it. Another possibility
is to set up a web service in each app to pass vars to the other app. Since the web service would recognize the session ID, it could pass back the info. NOTE: For high security, you would have to encrypt the data before throwing into the web service return, as a sniffer could get session IDs and query
your web service. I have not tested this yet, either.

As for the article you link to, you can do what the article suggests without the massive delete, edit the .webinfo file crap if you set up the parent app and make the other "apps" subdirs of the parent app (importing, if child
apps already completed). This is really a non-solution for most of us, as
you are essentially killing the child apps and making a single parent app
with all of your applications. You cannot set up the application on a unique CName, like app1.mydomain.c om, as it is tied to the other apps*. Yuck!

* Actually, there is a way to kludge that too, but also not recommended.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***

"Mark" <ma*****@kc.rr. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Ok, I know that .net inherently does not share session data across asp.net projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net session
object (using state service). I'd like to start breaking out
our functionality into component projects, but I'd like to get this

session
issue worked out first.

Any ideas??

I found this article , but it sounds like kind of a pain.

http://www.asp101.com/articles/jayra...te/default.asp


Nov 18 '05 #3
Hi. I've seen this question a bunch of times, and I was interested in it as well, so I tried to pull together everyone's info.
Session state cannot (and should not) be shared because it would be unsecure to do so. In fact, session data isn't completely secure unless you force an SSL connection. Even then, there are issues with older versions of IIS (5.1 and below) where your session state is lost of you browse from an SSL connection to a non-SSL connection, or vice versa.

Using the application object will persist data in the application collection and make it available to all sessions in an app, but there's no way to restrict access.

So, alternatives to sharing session state seem to be:

- Use a SQL database to persist session variables at the end of each session. This allows for access restrictions. You can use the client's cookie as an identifier if you wish. (from 2 seperate posts)

- Implement your own COM component with shared data. Your apps would call that component.

- Use a message queuing system like MSMQ to save or cache data in a "queue which can either
reside locally or on a dedicated server. Any application can read the queue
once it knows the path to the queue - it typically does
You can store the message in any format from text, to
full blown datasets or custom objects. You can think of the msmq as a robust
caching strategy over a network. It's a good approach because the msmq can
be configured to be fail safe (survive reboots), back up messages, provide
confirmation etc. In addition, msmq can be programmed in a line or two, but
it does require the msmq service to installed and running on the machine." (from "How can I share cached data between web clients?")

- Use the solution in the article at http://www.asp101.com/articles/jayra...te/default.asp. However, one poster said, "you can do what the article suggests without
the massive delete, edit the .webinfo file crap if you set up the parent app
and make the other "apps" subdirs of the parent app (importing, if child
apps already completed). This is really a non-solution for most of us, as
you are essentially killing the child apps and making a single parent app
with all of your applications. You cannot set up the application on a unique
CName, like app1.mydomain.c om, as it is tied to the other apps*. Yuck"

- Use remoting.

- Use the Caching Application block.

A good topic on MSDN is "State Management Recommendations " at http://msdn.microsoft.com/library/de...tateoption.asp. It outlines some of the options above.

"Mark" wrote:
Yeah, we are already using a central (single) state server for all web
servers in our farm, so I knew about the encrypt decrypt thing for that.

I'm just talking about sharing the session between apps. I'm aware of some
of the hacks you mentioned. I guess I'm just looking for a fairly clean
solution, but it doesn't look like that exists.

thanks .

"Cowboy" <No************ @comcast.netNoS pamM> wrote in message
news:uC******** ******@TK2MSFTN GP12.phx.gbl...
Set the encrypt and decrypt key to the same value in each web. Then, set

the
authentication cookie name (forms auth) to the same name. This will
authenticate the user once for any number of servers. NOTE: If you farm,

you
will have to use the same Session Server for all machine (I have not
personally tested this, however).

For session variables, I have yet to have found a solution. Currently, we
persist session vars in a SQL Server database with a timestamp (cleared

out
12 hours later). You can then grab the vars in the other app.

I have a theory that placing the applications in the same pool in IIS

might
allow sharing of session vars, but have not tested it. Another possibility
is to set up a web service in each app to pass vars to the other app.

Since
the web service would recognize the session ID, it could pass back the

info.
NOTE: For high security, you would have to encrypt the data before

throwing
into the web service return, as a sniffer could get session IDs and query
your web service. I have not tested this yet, either.

As for the article you link to, you can do what the article suggests

without
the massive delete, edit the .webinfo file crap if you set up the parent

app
and make the other "apps" subdirs of the parent app (importing, if child
apps already completed). This is really a non-solution for most of us, as
you are essentially killing the child apps and making a single parent app
with all of your applications. You cannot set up the application on a

unique
CName, like app1.mydomain.c om, as it is tied to the other apps*. Yuck!

* Actually, there is a way to kludge that too, but also not recommended.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***

"Mark" <ma*****@kc.rr. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Ok, I know that .net inherently does not share session data across asp.net projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net session
object (using state service). I'd like to start breaking out
our functionality into component projects, but I'd like to get this

session
issue worked out first.

Any ideas??

I found this article , but it sounds like kind of a pain.

http://www.asp101.com/articles/jayra...te/default.asp



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3962
by: ndsoumah | last post by:
hello guys I'm trying to get access to variables I put in a session variable from another page and it fails... here's the exact situation main file page1.php
2
5221
by: Brad | last post by:
Hi everyone, I've been using ASP on a few different projects over the past year, either using Javascript or VBScript. During that time, I've made use of session variables, but even then, I've tried to keep those variables to a minimum (which is not always easy). I've also read on many ASP resource sites (such as fuzzysoftware.com, etc)...
4
1694
by: Bill Dodd | last post by:
Is there really no way to have different asp.net applications share session variables? The problem I'm running into is that I have numerous asp.net (and asp) applications that were written as standalone apps and are now one by one being added to an umbrella project. For instance OpenOrderReport is a asp project with numerous references to...
3
1994
by: grooby | last post by:
I would like to develop an asp.net Web application using muliple web projects under one solution file and share the session information between web applications( or projects). Is this possible?
10
7881
by: Anthony Williams | last post by:
Hi gang, This one looks like a bug :o( As you may or may not know, setting session management in web.config to use cookieless sessions causes the ASP.NET runtime to munge a session ID into the URL, in the format http://yourapplicationpath/(Session.SessionID)/... which saves numerous headaches when it comes to storing state across page...
9
5299
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of copy paste (I hear this will improve in ASP.Net 2 via master pages). When I navigate from one page to the next the header and footer user controls...
0
1137
by: Oli | last post by:
My company has developed 2 win apps and 1 web app. All 3 apps use a 'common' business logic component (vb.net dll) and data access component. We recently refactored the common components to use common error handling and database auditing. This is done in the data access (DA) component (layer). When a user on the web app logs in (forms auth),...
1
1470
by: =?Utf-8?B?TmVpbGUgQmVybXVkZXM=?= | last post by:
Hi there My team is responsible for designing the architecture of the web hosting environment in my orgnaisation. We plan to implement an IIS web farm, load balanced by a couple of industry standard hardware load-balancers. One of the things we are pondering at the moment is state persistence. A number of our internal .net applications will...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.