Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. private IWebOperationContext context = new WebOperationContextWrapper(WebOperationContext.Current); // Get the context
  2.  
  3. context.OutgoingResponse.StatusCode = HttpStatusCode.Unauthorized; // Set the 401
  4.  
  5. throw new WebFaultException(System.Net.HttpStatusCode.Unauthorized);
  6.  
  7. HttpContext context = HttpContext.Current;
  8. context.Response.StatusCode = 401;
  9. context.Response.End();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement