Public class Global: system. Web. httpapplication
...{
Protected void application_start (Object sender, eventargs E)
...{
System. runtime. remoting. remotingconfiguration. Configure (server. mappath (httpcontext. Current. Request. applicationpath + "/Web. config"), false );
Application ["helper"] = new helper ();
String Password = "";
Intptr accesstoken = new intptr (0 );
Simplecrypto. passworddecrypt (configurationmanager. receivettings ["upload_passwd"], out password );
If (networksecurity. logonandgettoken (configurationmanager. deleettoken ["upload_site"],
Configurationmanager. deleettings ["upload_user"], password,
Configurationmanager. configurettings ["upload_network_logontype"], configurationmanager. configurettings ["upload_network_logonprovider"],
Ref accesstoken) = false)
...{
Throw new exception ("Logon Failed ");
}
Password = "";
Application. Add ("accesstoken", accesstoken );
Httpcontext. Current. User = new windowsprincipal (New windowsidentity (intptr) application ["accesstoken"]);
(Httpcontext. Current. User. Identity as windowsidentity). Impersonate ();
Filestream FS = new filestream (configurationmanager. appsettings ["uploadsgft"], filemode. Open, fileaccess. Read );
Streamreader ST = new streamreader (FS, system. Text. encoding. Default );
String word;
Dictionary <string, string> postfilter = new dictionary <string, string> ();
While (WORD = ST. Readline ())! = NULL)
...{
If (! Word. Trim (). startswith ("//")&&! Postfilter. containskey (word. Trim (). tolower ()))
Postfilter. Add (word. Trim (). tolower (), String. Empty );
}
St. Close ();
Application. Add ("filtertext", postfilter );
}
Protected void application_end (Object sender, eventargs E)
...{
Networksecurity. closetoken (intptr) application ["accesstoken"]);
Application. Clear ();
}
}