ASP.NET Session Expires Whenever the markup is changed - asp.net

I am having strange problem while testing my application. Every time i make change in .aspx page "means change any html", and when i refresh the page it takes me to the login page.
Thus the Session is expiring every time i make change in .aspx page.
I was not experiencing this problem before.
I am using Visual Studio 2012 with TFS
Any Suggestions
Thanks

Changing .aspx does not mean changing html. If you using and changing server controls you have to rebuild app every time before lunch.
If you don't want Session to drop after recompile you can use StateServer(ASP.NET session state service)
You can check more here: Session-State Modes

Related

Is there a web server or application level setting that indicates to the browser that the page has been modified?

We have an issue where when we upgrade our ASP .NET web application, some customers still see the old pages (old code) instead of the new code.
Would like to know if there is a server or application level setting that indicates to the browser that the page has been modified and forces a download instead of loading from cache, without having to make any code change?
Thanks,
Sunil

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

ASP.NET keep alive page using aspx vs. html

I have having trouble with my hosted site taking a long time to render the first page when it has not been accessed for a while. I wanted to create a keep alive page that I would call every 15 minutes to make sure the site stays up and running. Can I create an html page or must I create an aspx page for this to work? Will the thread pool recognize the html page that is not part of my ASP.NET project and make sure the site is not shut down?
You're going to have to create a page which hit's the .net process. You can do an html page, but you're going to have to have something on that page that hit's the asp.net process.

How to mantain session in classic asp sharing it with .net?

we are developing into an asp classic application introducing new asp.net pages.
The session variables are shared through the login.asp, everything works fine...
The problem that we are facing now is that the asp classic session expires meanwhile the user is navigating the .net pages and tries to go again into an asp page... the session in asp has expired because the user has been browsing for more than 20 minutes the aspx pages.
Thanks in advance
Ariel Gimenez
May be you can keep your Classic ASP session alive when a user browse in a ASPX page by:
adding a hidden iframe in your ASPX page that load an ASP Page
' aspx page ....
<iframe src='keep_session.asp' style='display:none'></iframe>
OR use an AJAX post from your ASPX page every 10 minutes to an ASP page to keep the ASP session active
I think you can find interesting:
http://msdn.microsoft.com/en-us/library/aa479313.aspx
update
I think this is the key:
"The native ASP session can only store session data in memory. In order to store the session data to SQL Server, a custom Microsoft® Visual Basic® 6.0 COM object is written to manage the session state instead of using the native session object. This COM object will be instantiated in the beginning of each Web request and reload the session data from SQL Server. When the ASP script is finished, this object will be terminated and the session state will be persisted back to SQL Server."
Do you retrieve asp session from db too?
I can think of two ways around this:
Increase the session timeout setting to be longer then 20 minutes.
Add a redirect page between common pages of the .aspx navigation.
This would redirect to an asp page, and then on to the correct destination, ensuring the session object didn't timeout.

ASP Session variable vs ASP.NET Session variables

Okay, it’s an established fact that the Session object in ASP has no relation to the Session object in ASP.NET.
My question is this: If I have an ASP page, and it calls an ASPX page, which then does a Response.Redirect to another (or the same) ASP page, will the Session variables from the original ASP page be preserved in the final ASP page? Does anybody know the answer, or do I need to experiment and see?
will the Session variables from the
original ASP page be preserved in the
final ASP page?
Short answer: yes.
This is no different than if you left a page on your ASP site, used that browser window/tab to go to another site like Google, then came back. Your session will be preserved as long as it hasn't timed out or been collected, or any of the other standard things that can happen to invalidate a session.
The ASP and ASP.NET apps are effectively separate applications - almost separate sites, even if they live in the same folder structure - that happen to be running on the same server. They can't share data (without jumping through some hoops like storing things in a database) and aren't aware of each other.
One way to share session variables between asp and asp.net is: http://www.eggheadcafe.com/articles/20021207.asp
I don't believe your session variables will be destroyed unless you either close the browser or clear the session via code.
Yes, the session will exist in asp classic in most circumstances. A few things to consider though:
If the classic pages are not requested again before the SessionTimeout has been reached the instances will be destroyed
If you're running on IIS 7 and redirecting between SSL and non SSL pages there may be different sessions in classic depending on the site configuration properties

Resources