-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostLoggerHttpModule.cs
More file actions
46 lines (39 loc) · 1.39 KB
/
PostLoggerHttpModule.cs
File metadata and controls
46 lines (39 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Web;
namespace RdpDomainUserNameLogger
{
public class PostLoggerHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
private void context_BeginRequest(object sender, EventArgs e)
{
if (sender != null && sender is HttpApplication)
{
var request = (sender as HttpApplication).Request;
var response = (sender as HttpApplication).Response;
if (request != null && response != null && request.HttpMethod.ToUpper() == "POST")
{
if (request.Form["DomainUserName"] != null)
{
var body = HttpUtility.UrlDecode(request.Form["DomainUserName"].ToString());
if (!string.IsNullOrWhiteSpace(body))
{
if (request.QueryString.Count > 0)
{
response.AppendToLog("&");
}
response.AppendToLog("DomainUserName=");
response.AppendToLog(body);
}
}
}
}
}
}
}