Don't talk about it. paste the Code directly. After studying it for a long time, I finally got it through. Some small channels will be cheated if I don't pay attention to it.
Haha. Using system;
Using system. Data;
Using system. configuration;
Using system. collections;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
/** // <Summary>
/// Summary description for blogpage
/// </Summary>
Public partial class blogpage: system. Web. UI. Page
{
Private string m_strmasterpagefile;
Protected void page_preinit (Object sender, eventargs E)
{
If (! Ispostback)
{
Setpage ();
}
}
Set the display content # Set the display content of Region
/** // <Summary>
/// Set the display content
/// </Summary>
Private void setpage ()
{
Try
{
This. masterpagefile = m_strmasterpagefile;
}
Catch
{
}
}
Public override string stylesheettheme
{
Get
{
Try
{
If (page. theme = NULL)
{
String blogname = request. querystring ["blogname"];
If (blogname! = NULL & blogname! = "")
{
Dataset DS = userinfo. queryblog (blogname );
Page. theme = Ds. Tables [0]. Rows [0] ["themaname"]. tostring ();
Session ["blogid"] = Ds. Tables [0]. Rows [0] ["userid"]. tostring ();
M_strmasterpagefile = This. masterpagefile = "~ /Blog/"+ Ds. Tables [0]. Rows [0] [" layoutname "]. tostring () +" masterpage. Master ";
Arraylist ary;
If (session ["visitlist"] = NULL)
{
Ary = new arraylist ();
}
Else
Ary = (arraylist) session ["visitlist"];
If (! Ary. Contains (INT) ds. Tables [0]. Rows [0] ["userid"])
{// If you have not accessed
Ary. Add (INT) ds. Tables [0]. Rows [0] ["userid"]);
Session ["visitlist"] = ary;
Userinfo. addblogvisit (INT) ds. Tables [0]. Rows [0] ["userid"]);
}
DS. Dispose ();
DS = NULL;
}
}
}
Catch
{
Page. theme = "default ";
This. Page. masterpagefile = "~ /Blog/defamastermasterpage. Master ";
}
Return page. theme;
}
}
# Endregion
}
Www.gofordesign.com