473,489 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

HttpException after Session Timeout

Hello NG,

In my Web-Application I want to redirect the User to the Login-Page
whenever his Session has timed out. According to a lot of NewsGroup
Entries this can be achieved by the following code in global.asax

public Global()
{
InitializeComponent();
this.PreRequestHandlerExecute += new System.EventHandler
this.OnPreRequest);
}

protected void Session_Start(Object sender, EventArgs e)
{
Session["NeedsLogin"] = true;
}

protected void OnPreRequest(object sender, System.EventArgs evt)
{
if ((bool) Session["NeedsLogin"] == true)
Server.Transfer ("login.aspx");
}
Hence I face the following problem. Whenever my Session times out I
get the following HttpException.

HttpException (0x80004005):
Der Anzeigestatus für diese Seite ist ungültig, da er möglicherweise
beschädigt wurde.]

The Text is german and can be translated to : "invalid viewstate page
has possibly been damaged"

All pages are initialized with <%@ Page ... enableSessionState="true"
%>

Can anyone help me
Rolf
Nov 18 '05 #1
3 1781
Do you have enableViewStateMac = true in your app?
Nov 18 '05 #2

"Rolf Gossen" <ro*********@gmx.de> wrote in message news:d3************************@posting.google.com ...
Hello NG,

In my Web-Application I want to redirect the User to the Login-Page
whenever his Session has timed out. According to a lot of NewsGroup
Entries this can be achieved by the following code in global.asax ....
protected void OnPreRequest(object sender, System.EventArgs evt)
{
if ((bool) Session["NeedsLogin"] == true)
Server.Transfer ("login.aspx");
}
Hence I face the following problem. Whenever my Session times out I
get the following HttpException.
....
"invalid viewstate page has possibly been damaged"
...
Can anyone help me
Rolf


The problem is not the session timeout, but the server.transfer.
The viewstate is marked by the page that has generated it. When you
transfer to a different page (login.aspx) the stored originating page
is not equal to the current page and this is the reason for the errormessage.

Two possible solutions:
- simply change Server.Transfer to Response.Redirect
- set enableViewStateMac to false (in the @page directive in your login.aspx)

Hans Kesting
Nov 18 '05 #3
> Two possible solutions:
- simply change Server.Transfer to Response.Redirect
- set enableViewStateMac to false (in the @page directive in your login.aspx)

Hans Kesting

Thanks a lot it works fine.
But...
It is only the second solution that works. I don't bother since I only
need one working solution.

Rolf
Nov 18 '05 #4

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

Similar topics

0
12417
by: Steve | last post by:
Hi All, I keep getting the "System.Web.HttpException: Request timed out." error message when I was uploading image files (about 400 image files) to SQL table, all those image files are FTP to...
12
43150
by: Geigho | last post by:
Setting session timeout in web.config file does not seem to have any effect. Any explanation or suggestion will be appreciated.
3
1562
by: Rolf Gossen | last post by:
Hello NG, In my Web-Application I want to redirect the User to the Login-Page whenever his Session has timed out. According to a lot of NewsGroup Entries this can be achieved by the following...
4
15443
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site...
11
2983
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
17
5176
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be...
4
9411
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
25
6031
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I tried: <sessionState timeout="1"> </sessionState> bounced IIS, and after 1 minute still had a session. ??? -- thanks - dave
6
3751
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7352
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...
0
5445
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,...
0
4565
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...
0
3078
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...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.