开发者

How to return nothing and close connection in asp .net for GET request

I have a simple asp .net web form. I want to let the web form return nothing and close connection immediately when the particular value at Query String is not right. How do I do that?

I mean stop processing the request without returning anything at all and close the connection. 开发者_StackOverflowAny idea?


Although Response.End() has been mentioned, it raises exceptions (ThreadAbortException). If you're expecting to do this often, then the performance of your site might decrease because of this. Instead, you could use HttpApplication.CompleteRequest which ends the request, but not throw an exception.


Something like this:

Response.ClearContent();
Response.End();

You can call this from the master page, the page or a user control.

You can get the response object otherwise using HttpContext.Current.Response

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜