How to Response.Write on IIS7.5?

后端 未结 3 725
醉梦人生
醉梦人生 2021-01-07 10:04

i am trying to write out a response to the client:

response.StatusCode = (int)HttpStatusCode.BadRequest;
response.ClearContent();
response.Write(String.Forma         


        
3条回答
  •  余生分开走
    2021-01-07 10:44

    By default, IIS 7 will change the response if the code is >= 400 http://msdn.microsoft.com/en-us/library/ms690497(v=vs.90).aspx

    But you can change this in the httpErrors element of system.webServer.

    
    

    EDIT: this will break CustomErrors, if you are using that. You might be better off returning a 400 without a response, then setting up web.config to redirect to a custom page for 400 errors.

    
        
    
    

提交回复
热议问题