Urlrewrite in Asp.net forums

Source: Internet
Author: User

At the beginning, of course, from httpmodule, It is the forumshttpmodule class.

(The common file forumconfiguration. CS cannot be ignored.CodeIt's relatively simple, so I won't talk about it)

--> Init () function, in which two timer timers are defined every 15 minutes after the hook event is applied.

--> According to the application event sequence, the first step is application_beginrequest ()

--> The rewriteurl () function is called.

--> Then call globals. getsiteurls (); (intermediate transition)

--> Call siteurls: siteurls () to read the siteurls. config file, that is, the URL conversion rule.

--> After the response is returned, the actual rewriting is started. The code is in the rewrittenurl. CS file.

People familiar with siteurls. config actually know how to operate it, because it is not as classized as dottext, but the naming is a bit messy.

~~~~~~~~~~~~~ However, do not ignore this small piece of code.

Forumcontext frmcontext = createforumcontext (context );
Frmcontext. currenturl = context. Request. rawurl. tostring ();

// 2005/04/07
// Safe to set URL rewrite data;
If (isrewritten & newpath! = NULL)
{
Frmcontext. isurlrewritten = true;
}

<Pages validaterequest = "false" autoeventwireup = "true" pagebasetype = "aspnetforums. components. forumpage, aspnetforums. Components"/>

The forumpage class is extended from the page class and implemented to rewrite the action attribute to the changed URL. This is an attribute added by Asp.net and used for the post

~~~~~~~~~~~~~~~~~~~~~~~~~~~

--> Captureforumpingback () is another important function ()

It implements RSS subscription. Note that it is not the subscription of posts, but the RSS subscription in the upper-right corner of each Forum.

--> Forumsdataprovider dp = forumsdataprovider. instance (); sqldataprovider class

The following sentence DP. rsspingback (pingbacklist); call the Stored Procedure forums_forum_rsspingback_update to update the table forums_forumpingback record

The function here seems to be just about updating the number of RSS subscriptions.

-------------------------------------------------

In chronological order, followed by application_authenticaterequest ()

--> The verification method is determined, for example, the "itelite passport usage instructions" attached to the visible download package for passport/negotiate"

--> Finally, no matter which authentication mode is used, context. User = new genericprincipal (context. User. Identity, rolearray) in roles. getuserroles );

-------------------------------------------------

Next is application_authorizerequest (), tracking anonymous users (this part is not detailed, but the two or three functions are unclear), and determining whether the user has the permission to access the page, not turning to logout page

-------------------------------------------------

Then, before leaving the httpmodule, let's look at the functions implemented by the two timers.

--> Mount scheduledworkcallbackemailinterval () on emailtimer to enable email sending/anonymous online update.

--> Emails. sendqueuedemails (httpcontext) sender );

It is a common technology to store emails in a database and use a timer to send emails to a group. Here, the mailmessage class is derived from a new class emailtemplate to record the number of failed sending attempts. Another point is to use the fields attribute for SMTP server user verification.

--> Statstval Mount scheduledworkcallbackstatsinterval () to implement index and statistics.

--> Among them, search. indexposts (httpcontext) sender, 100 );

The process principle of the simulated full-text search of ANF is described in detail here, to update the index of the latest 100 posts every 15 minutes.

 

 

 

Related Article

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.