Asp.Net web service: I would like to return error 403 forbidden

后端 未结 9 788
轻奢々
轻奢々 2020-12-01 13:38

I have got a web service programmed in c# / asp.net.

[WebService(Namespace = \"http://example.com/\")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProf         


        
9条回答
  •  孤城傲影
    2020-12-01 14:25

    You don't need to set both Context.Response.Status and Context.Response.StatusCode. Simply setting

    Context.Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden
    

    will automatically set Response.Status for you.

提交回复
热议问题