httpModule for verification of FormsAuthentication cookie on request, using a custom attribute.
[RequiresAuthentication]
[WebMethod]
public string AjaxMethod() {
[RequiresAuthentication]
public partial class WebFormsPage : System.Web.UI.Page
[RequiresAuthentication]
public partial class WebFormsMasterPage : System.Web.UI.MasterPage
[RequiresAuthentication]
[System.Web.Script.Services.ScriptService()]
[WebService(Namespace = "http://localhost:8080/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public class AspAjaxWebService : System.Web.Services.WebService
{
}
<RequiresAuthentication>
<WebMethod>
public function AjaxMethod() as string
<RequiresAuthentication>
Partial Class WebFormsPage
Inherits System.Web.UI.Page
<RequiresAuthentication>
Partial Class WebFormsMasterPage
Inherits System.Web.UI.MasterPage
<RequiresAuthentication>
<System.Web.Script.Services.ScriptService()>
<WebService([Namespace]:="http://localhost:8080/")>
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<[global].Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class AspAjaxWebService
Inherits System.Web.Services.WebService
End Class
Remember to set the FormsAuthentication cookie!