title: Hiding the stacktrace for an exception returned by a asp.net WebMethod?
body: <p>I am using methods with the Attribute [WebMethod] in my aspx pages. I don't use any asp.net ajax but jQuery to call these methods and return objects in JSON. This all works fine.</p>
  
  <p>Next I added an authorization check inside the webMethod, if the current user doesn't have access to the feature I need to let the calling JavaScript know.</p>
  
  <p>So I am throwing an AccessViolationException exception which can then be parsed by the OnError callback function in JavaScript. This works too but the exception includes the full StackTrace and I don't want to make this available to the calling client.</p>
  
  <p>What other ways I could use to return an "Access Denied" to the client when the WebMethod returns a business object?</p>
  
  <p>I'm using ASP.Net 3.5SP1 and jQuery 1.32</p>