1: class EncryptQueryString:IHttpModule
2: {
3: #region IHttpModule Members
4:
5: /// <summary>
6: /// Disposes of the object
7: /// </summary>
8: public void Dispose()
9: {
10: }
11:
12: /// <summary>
13: /// Initializes the object
14: /// </summary>
15: /// <param name="context">Application object</param>
16: public void Init(HttpApplication context)
17: {
18: context.AcquireRequestState += new EventHandler(context_AcquireRequestState);
19: }
20:
21: /// <summary>
22: /// Decrypts the query string and forwards it to the proper spot
23: /// </summary>
24: /// <param name="sender">Application object</param>
25: /// <param name="e"></param>
26: void context_AcquireRequestState(object sender, EventArgs e)
27: {
28: HttpApplication Application = (HttpApplication)sender;
29: HttpContext Context = Application.Context;
30: string EncryptedString = Context.Request.QueryString["Request"];
31: if (string.IsNullOrEmpty(EncryptedString))
32: return;
33: string OtherQueryStringValues="";
34: foreach (string Key in Context.Request.QueryString.Keys)
35: {
36: if (!Key.Equals("Request"))
37: {
38: OtherQueryStringValues += "&" + Key + "=" + Context.Request.QueryString[Key];
39: }
40: }
41: string DecryptedString = //Decrypt string here
42: Context.Server.Transfer(Context.Request.AppRelativeCurrentExecutionFilePath + DecryptedString + OtherQueryStringValues);
43: }
44:
45: #endregion
46: }