Sunday, 15 January 2012

asp.net - Interrupting POST request -


I am working on the asp.net file uploader and am currently trying to solve the following problem: something The server-side HTTP module at the moment determines that incoming data stream is too long and should be abrogated. So the code that handles this situation at first glance will be very simple. Like this:

  try {... if (size> = maximum size) throw a new invalid operation exception ("the file is too big!"); } Hold (invalid operation exception e) {HttpContext.Current.Response.Write (e.Message); HttpContext.Current.Response.End (); Return; }  

But unfortunately it does not work. It seems that the browser has not received a response and the data continues to be transferred to the server. Does anyone know why this does not work and how will it work?

Try calling the call instead () Close it immediately socket Will close the connection. response Flush () may need to be called before hand.


No comments:

Post a Comment