By default, an article can be found by the search engine and accessed. If you do not want to access some topics, You need to modify the Page code.
The procedure is as follows:
Add the following method to the webuser class:
Public static bool hasreadpermissions (INT siteid, int moduleid, int pageid)
{
If (httpcontext. Current = NULL | httpcontext. Current. User = NULL) return false;
If (isadmin | iscontentadmin) return true;
Module module = new module (moduleid, pageid );
Pagesetaskpagesetask= new pagesetask( siteid, module. pageid );
If (isinroles (pagesettings. authorizedroles) | isinroles (module. authorizededitroles ))
{
Return true;
}
If (module. edituserid> 0)
{
Sitesettings = (sitesettings) httpcontext. Current. items ["sitesettings"];
Siteuser = new siteuser (sitesettings, httpcontext. Current. User. Identity. Name );
If (module. edituserid = siteuser. userid)
{
Return true;
}
}
Return false;
}
Modify the page_load method for the page to be controlled as follows:
Private void page_load (Object sender, eventargs E)
{
Securityhelper. disablebrowsercache ();
Loadparams ();
If (! Webuser. hasreadpermissions (sitesettings. siteid, moduleid, currentpage. pageid ))
{
Siteutils. redirecttoaccessdeniedpage ();
}
If (parametersareinvalid)
{
This. pnlblog. Visible = false;
Return;
}
Getmodulesettings ();
Setupcss ();
Populatelabels ();
If (! Ispostback & moduleid> 0 & Itemid> 0)
{
If (context. User. Identity. isauthenticated)
{
If (webuser. haseditpermissions (sitesettings. siteid, moduleid, currentpage. pageid ))
{
Iseditable = true;
}
}
Populatecontrols ();
}
}