Hello,
I am working in c# asp.net.
My page is geting logout as soon as any ostback events fires. For ex . : Dropdown selected event change, radio button event or button click.
I have already used EnableViewSate to TRUE on page directives , still it is getting loggedout.
Even i put thse controls in update panel and in Trigger.
Note : sometmes debugger goes in global.asax and it shows "Maximum length exceeded", so i change web config accordingly, still no luck
Pleae let me know any fix or feedback ?
Deepika SawantPosted Jun 24, 2025, 10:52 AM
It looks like your issue is related to "Maximum request length exceeded", which can cause unexpected logouts when postback events fire. Here are some possible fixes:
1. Increase
maxRequestLengthinweb.configYour postback might be sending a large amount of data (e.g., ViewState, form data). Try increasing the request length in
web.config:This increases the maximum request size to 32 MB.
2. Reduce ViewState Size
Even though you set
EnableViewState="true", excessive ViewState can cause large postback sizes. Try disabling ViewState for unnecessary controls:3. Check IIS Request Filtering
If your application is hosted on IIS, you may need to adjust the
maxAllowedContentLengthsetting:This increases the allowed request size to 30 MB.
4. Debug Global.asax Events
Since your debugger enters
Global.asax, check if Session_End or Application_Error is triggering a logout. You can log session expiration events:5. Check Authentication Timeout
If your authentication session is expiring too quickly, increase the timeout in
web.config:This sets the session timeout to 60 minutes.
6. Use UpdatePanel Correctly
If you're using an
UpdatePanel, ensure that triggers are correctly set:Try these fixes one by one and see if your issue is resolved. If the logout still happens, check event logs in IIS or
Global.asaxfor unexpected session expirations.