Skip to content

Latest commit

 

History

History
79 lines (66 loc) · 1.89 KB

README.md

File metadata and controls

79 lines (66 loc) · 1.89 KB

Verify FormsAuthentication cookie on request through custom attribute

httpModule for verification of FormsAuthentication cookie on request, using a custom attribute.

Currently supported use cases:

C#:

Decorated on a PageMethod or ASP.NET Ajax WebMethod:

[RequiresAuthentication]
[WebMethod]
public string AjaxMethod() {

Decorated on a Page, MasterPage or ASP.NET Ajax WebService Class:

Page Class:
[RequiresAuthentication]
public partial class WebFormsPage : System.Web.UI.Page
MasterPage Class:
[RequiresAuthentication]
public partial class WebFormsMasterPage : System.Web.UI.MasterPage
WebService Class:
[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
{
}

VB:

Decorated on a PageMethod or ASP.NET Ajax WebMethod:

<RequiresAuthentication>
<WebMethod>
public function AjaxMethod() as string 

Decorated on a Page, MasterPage or ASP.NET Ajax WebService Class

Page Class:
<RequiresAuthentication>
Partial Class WebFormsPage
    Inherits System.Web.UI.Page
MasterPage Class:
<RequiresAuthentication>
Partial Class WebFormsMasterPage
    Inherits System.Web.UI.MasterPage
WebService Class:
<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!