1
1
# Verify FormsAuthentication cookie on request through custom attribute
2
- httpModule for verification of FormsAuthentication cookie on request, using a custom attribute.
3
2
4
- ## Currently supported use cases:
3
+ > httpModule for FormsAuthentication verification on requests using custom attributes.
5
4
6
- ### C#:
7
5
8
- #### Decorated on a PageMethod or ASP.NET Ajax WebMethod:
6
+
7
+ ## Currently supported use cases - C#:
8
+
9
+ ### Decorated on spesific PageMethod's or Ajax WebMethod's:
9
10
10
11
``` csharp
11
12
[RequiresAuthentication ]
@@ -14,18 +15,17 @@ public string AjaxMethod() {
14
15
```
15
16
16
17
17
- #### Decorated on a Page, MasterPage or ASP.NET Ajax WebService Class:
18
- ##### Page Class:
18
+ ### Decorated on Page Class:
19
19
```csharp
20
20
[RequiresAuthentication ]
21
21
public partial class WebFormsPage : System .Web .UI .Page
22
22
```
23
- ##### MasterPage Class:
23
+ ### Decorated on MasterPage Class:
24
24
```csharp
25
25
[RequiresAuthentication ]
26
26
public partial class WebFormsMasterPage : System .Web .UI .MasterPage
27
27
```
28
- ##### WebService Class:
28
+ ### Decorated on WebService Class:
29
29
```csharp
30
30
[RequiresAuthentication ]
31
31
[System .Web .Script .Services .ScriptService ()]
@@ -39,31 +39,30 @@ public class AspAjaxWebService : System.Web.Services.WebService
39
39
40
40
-- -
41
41
42
- ### VB :
42
+ ## Currently supported use cases - VB.NET :
43
43
44
- #### Decorated on a PageMethod or ASP.NET Ajax WebMethod:
44
+ ### Decorated on spesific PageMethod's or Ajax WebMethod's :
45
45
```vb
46
46
< RequiresAuthentication >
47
47
< WebMethod >
48
48
public function AjaxMethod () as string
49
49
```
50
50
51
- #### Decorated on a Page, MasterPage or ASP.NET Ajax WebService Class
52
- ##### Page Class:
51
+ ### Decorated on Page Class:
53
52
```vb
54
53
< RequiresAuthentication >
55
54
Partial Class WebFormsPage
56
55
Inherits System .Web .UI .Page
57
56
```
58
57
59
- ##### MasterPage Class:
58
+ ### Decorated on MasterPage Class:
60
59
```vb
61
60
< RequiresAuthentication >
62
61
Partial Class WebFormsMasterPage
63
62
Inherits System .Web .UI .MasterPage
64
63
```
65
64
66
- ##### WebService Class:
65
+ ### Decorated on WebService Class:
67
66
```vb
68
67
< RequiresAuthentication >
69
68
< System .Web .Script .Services .ScriptService ()>
@@ -76,4 +75,15 @@ End Class
76
75
```
77
76
78
77
< br / >
79
- Remember to set the FormsAuthentication cookie !
78
+
79
+ -- -
80
+
81
+ ## DO NOT FORGET BEFORE USING:
82
+
83
+ * Make sure your FormsAuthentication cookie is set correctly
84
+ * Verify /change the assembly metadata for System .Web .Extensions which is used to get the Type definition for RestHandlerWithSession :
85
+ ```csharp
86
+ Type _RestHandlerWithSessionType = Type .GetType (" System.Web.Script.Services.RestHandlerWithSession, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" );
87
+
88
+ // the "Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" part must match YOUR spesific scenario
89
+ ```
0 commit comments