Sharepoint HttpModule implementation, sharepoint

Source: Internet
Author: User

Sharepoint HttpModule implementation, sharepoint

First, write an IHttpModule implementation class.

Using System; using System. collections. generic; using System. linq; using System. text; using System. threading. tasks; using System. web; namespace NuctechEquipment. layouts. nuctechEquipment. appCore. httpModules {public class ReqestModule: IHttpModule {// initialization --- public void Init (HttpApplication context) that must be implemented {// event registration ---------- customize the method to register context. beginRequest + = new EventHandler (Application_BeginRequeset); context. endRequest + = new EventHandler (Application_EndRequeset);} // start request --- method of the custom rewrite start request and method of the end request public void Application_BeginRequeset (object sender, EventArgs arg) {} // end request public void Application_EndRequeset (object sender, EventArgs arg) {HttpApplication app = sender as HttpApplication; Console. writeLine (app. request. filePath); if (app. request. filePath. contains (". aspx ") = false) {}} // release --- public void Dispose () {}} that must be implemented (){}}}


 

Then, configure it under the <modules runAllManagedModulesForAllRequests = "true"> node of webconfig under iis 80.

<Add name = "ReqestModule" type = "NuctechEquipment. Layouts. NuctechEquipment. AppCore. HttpModules. ReqestModule, NuctechEquipment"/>

-- The name is the same as the class name.

-- Before the type comma, the dll name of the class after the namespace + class comma

 

Finally, put the dll in the bin directory on the iis 80 website.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.