Session is not getting cleared - asp.net

I have a solution with multiple projects and 2 webapps in it. One webapp is related to asp.net website and the other one is related to MVC.
I opened a webpage one from asp.net site & other from MVC website.
Both the projects is having same timeout and similar code in global.asax.
Now there is a JS code in both the websites and every session timeout+1minute a regular call happens to the backend server to check session status.
In asp.net pages session is getting expired but in mvc site session still exists.

Set same timeout settings for both in web.config
<sessionState timeout="20"></sessionState>
follow links for more understanding which i have mentioned below:
Asp.net Session Expire soon on live Web server
Asp.net session expire very soon

Related

Maintaining .net mvc session from classic asp pages

As a requirement our team has to implement session management for our application, redirecting users to the login page on session expiry. The problem is the website is a mixture of classic asp pages, .net web forms and asp.net mvc.
To keep the .net session alive we can use http GET requests to a dummy controller method that will redirect to the login page if the session has expired.
Because there are a considerable amount of page in the application it would be good to avoid having to put an include file on each page to refresh the .net session on each page load. Also for each ajax request made from classic asp we want to refresh the .net session.
An ideal solution to this would be to intercept each request made to the server, pass them through the dummy controller method to refresh the .net session, redirecting the user if the session has expired. I have looked at creating an ISAPI module for this as a possibility but am still unsure of the workload involved in creating such a module, or if I can create the desired behavior.
Is anyone in a similar situation or have a concrete solution to this problem?

Lost session on asp page to asp.net page

Some part of my site is Asp and the other is Asp.Net.
I use session to save the information of current user in Asp pages.
However,the session is lost on redirecting to an Asp.net page.
Sometimes,the session would be saved in the first redirecting Asp.net page.
After a while, I click a button and find that session is still lost.
I am really confused about this situation.
How could this happen?
ps:
1.I have checked the time-out configuration, it seems to work well.
2.The cookie configuration in brower looks normal.
ASP and ASP.NET do not share Session state. They are completely different systems.
If you want to share Session state somehow between the two systems, you can use the method outlined in this article: http://msdn.microsoft.com/en-us/library/aa479313.aspx

Set Session in Asp page using Asp.net

I have a Login Page which is created in asp.net now when i successfully logins into my application i need to transfer session related information from my asp.net page to my asp page so how to set my session information in asp using asp.net.
Regards,
How to share session state between classic asp and asp.net
I see you mentioned wanting to use State Server. You could try NSession it allows sharing session state between Classic ASP and ASP.Net using State server. Pretty easy to setup just configure App to use State Server for session and register a couple of dll files.

Session transfer between asp.net and asp works in soome cases and in some cases not

I transfer session from asp.net to classic asp.
I use MSSQL DB for it.
I have
SomeWebPage.aspx - this page is asp.net which save sesion, after it, it call by redirect
SessionTransfer.aspx -this page save sessions to DB and call by redirect
SessionTransfer.asp - this page load session from DB and cal by redirect
SomeWebPage.asp - this page doesn't need now about other pages, it just use session.
Problem is, that it works only if SomeWebPage.aspx, SessionTransfer.aspx, SessionTransfer.asp and SomeWebPage.asp are in same folder, or in same "web pages" folder on iis.
How can i do it if SomeWebPage.asp will be in other web folder. On same IIS server, but it will be specific web?
I use IIS 5.1 for developing and finished program will run on IIS 6.0.
Problem was that it was different applications.
SessionTransfer.asp must be it same application like SomeWebPage.asp (it wasn't)
and
SessionTransfer.aspx must be it same application (pool) like SomeWebPage.aspx (it was)
It ws teddy-bear problem. When we start discus about this, i realized where is problem :-D
thanks amit_g

IIS generates same Session.SessionID

I have deployed two web applications on my IIS7.
The problem is, IIS is generating the same Session.SessionID if I request both application using the same browswer (different tabs).
This is causing some problem with ASP.Net user authentication, it is some how overlapping with each other and the flag "User.Identity.IsAuthenticated" returns false whenever the user logs in on to the other site. It works fine as long as user is working on one of the site.
Please help me out, I cant seem to find the reason for this, I mean the session is application specific so why is sessionID from one web app is conflicting with the other.
Thanks
They are running in the same application pool. Just separate the application pools.
Problem is your browser is treating these applications the same. Session in ASP.NET is implemented by the session cookie. These need to have different website names so that they do not share the same session.
UPDATE
This is how session cookie works.
But one solution is to access them as mysite.com/1 and mysite.com/2. That I believe should also work.
Did you checked application pools, if you want to isolate web application you should define different application pools.
Is each application running in a separate IIS Application? If they are, then the session will be separate, as Session is scoped to the AppDomain. If they are in the same IIS application, they are loaded in the same AppDomain, and will share Session.
In the same browser session (regardless of using tabs), the same Session cookie will be sent.

Resources