asmx - ASP.Net Web service. How to reject request? -
I have an ASMX web service and I would like to reject all incoming requests from all IP addresses, only I know.
I have used Application_BeginRequest but after confirming that IP is not IP, I would like to know what I want to change the comment in the code.
Thanks
Secure void Application_BeginRequest (object sender, EventArgs e) {var address = "916.222.18.0"; Var ip = context.Request.ServerVariables ["REMOTE_ADDR"]; If (IP! = Address) {// reject request}}
Try it:
Reference. response. Status code = (int) HTTitus code. Forbidden; Context.Response.End ();
Or you can redirect to another page that does not have a customer restriction:
context.response.Redirect ("head-fake. Aspx ");
Comments
Post a Comment