ASP.Net Post timeout

I am stuck with asp.net post issue with last 2 weeks.

Scenario:

My application page has 3 controls. A WYSIWYG editor (Free Textbox), a text box to get name of the article being edited in WYSIWYG editor, another text box to accept key words.

Order of the controls in page from top to bottom as follows,
first, Name text box
second, WYSIWYG Editor
last, Key Word text box

Problem:

When ever users tries to save their edited documents, IIS server returns time out (Production runs on win 2008). But interestingly, “Name text” box information and half of WYSIWYG Editor (its not exactly half, it varies for each case) information is saved to database. but last “keyword text” box is not saved. During this web server hangs for a while, kicks out the user and later after few mins back to normal speed. I think app pool is recycled. But all works fine on my development environment (in My PC runs on Win 7 64bit). Also i have set ValidateRequest=”False” in page directive for Production and Development environment.

Environment:

Environment .NET 4.0, ASP.NET
FreeText box WYSIWYG editor
Shared Hosting windows 2008
SQL Server 2008

Tried solutions (but no breakthrough):

Tried with Different Browser Firefox, chrome, IE and same error.
Added ValidateRequest=”False” in page directive and replaced WYSIWYG editor with plain text box and tried to save, same issue.
Just tried to log the post data directly from page.request object. Still getting full data for “Name textbox” half for WYSIWYG textbox and nothing for rest.
There is no issue on DB connection or table field. I have triple checked.

Possible Suspicions and Questions:

Based on my knowledge there is no limitation on post data length. but in IIS is it possible to override this ? wondering if this is set on my shared hosting.
Basically http post data gets truncated somewhere between browser and server.request object. What would be the reason if this is happening?
If http post is truncated why whole application hangs (or restarts)?
What are the precaution need to be taken when posting html content as http post?

Thank you.

New Finding:

Checked my post using httpfox. Post size was about 9958 bytes. But firefox sends first 330 bytes of data and then web page hangs. After about a minute, i am getting NS_ERROR_NET_RESET error code in httpfox.

Checked my post using filder2 with IE9. It tries to send first 512 bytes then hangs. Returns “ReadResponse() failed: The server did not return a response for this request.”

Question:

This likely would be browser issue or server issue. I think if browser issue, this wont happen for IE and Firefox.

Update:

Most likely isolated the problem towards web hosting. Tested by changing form post url to different domain and see if values can be retrieved at that domain. Yes it works. Only it didn’t work for my domain. Interestingly i tested this for normal html page post. it also didnt work. So most likely a security installed to prevent this or server misconfiguration. Already put a ticket to them and waiting.

Any how all of your feed back helped me to isolate the problem.

Solved:

Yes this issue was on our web hosting site. So far i heard from them is like some firewall blocking the big post from http. They said now our domain is white listed. Anyway, now its works. But this ate 2 weeks of my time, but it was good learning experience. Thanks guys for your help. Really appreciated.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I have face the same error on one web page. Its was very wired because if I was use proxy, the error go way, if I was called from my computer direct I have time out, and never go on.

The site that this issue appear until now Dec/2011 is the http://www.auctionsniper.com/
The same site works if I go with the mobile version of it.

After many checks with the above site I discover that the problem was with the very big viewstate !. How I find it: I save an html part of my page, as its rendered and start remove items from the html and make post, until I discover that the post continue when I cut down the viewstate post.

The solution was to disable viewstate on many non needed controls and compress+cut in smaller part the remaining viewstate post data.

You can google and find many ways to compress and cut the view state in parts.

Some articles:

http://msdn.microsoft.com/en-us/magazine/cc188774.aspx

how to cut it tutorial:
http://www.dotnetfunda.com/articles/article634-viewstate-patterns-in-aspnet-.aspx

how to compress it
http://www.hanselman.com/blog/ZippingCompressingViewStateInASPNET.aspx
http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx
http://www.google.com/search?hl=en&safe=off&q=asp.net+compress+viewstate&aq=f&aqi=g1g-b2&aql=f&oq=

Ps:
In this demo page of the free TextBox that you use, the viewstate is huge ! and its even empty from text, imagine how big the viewstate can be if you actual have and text inside. Not so free – the cost is the huge viewstate.

Follow up

As Jeyara say on the comments below, final this was the error, a blocking of large post files by a firewall on the hosting server.

So the error / timeout have to do with large post back data and its a rare but existing issue.

Method 2

Have you looked at whats being posted back?

Try something like Fiddler2 to view the postback.

You may find that something is being truncated at the browser.

The RichText area may also be limited by the number of chars it will post back.

Method 3

Try this, In your web.config , add the following

      <httpRuntime maxRequestLength="8096"/>

somewhere in <system.web> tag, since the default request length is 8096, your postdata might be greater than that, so add it with a bigger value than i provided. Hope this shall help.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x