UsingSystem;UsingSystem.Collections.Generic;UsingSystem.IO;UsingSystem.Linq;UsingSystem.Web;UsingSystem.Web.UI;UsingSystem.Web.Ui.HtmlControls;UsingSystem.Web.Ui.WebControls;UsingJgdjweb.Helper;UsingJgdjweb.Model;NamespaceJgdjweb.Extensions {PublicAbstractClassPagebase:System.Web.Ui.Page {ProtectedPagebase () {}ProtectedvoidBindmodule (PagePageaction<Repeater,String>BINDSINGRPT) {Bindcontrols (Page"List_",BINDSINGRPT); }ProtectedvoidBindcontrols (PagePageStringPrefixaction<Repeater,String>Bindsingcontrol) {VarControllist =Page.Controls;foreach (ControlControlInchControllist) {if (Control.ID! =Null &&Control.FdaStartsWith (Prefix) &&ControlIsRepeater) {Varsuffix =Control.Id.Split (' _ ') [1];if (prefix = ="List_")Bindsingcontrol (ControlAsRepeater,suffix); } } }ProtectedvoidBind (StringClassName,HtmlAnchorAnchorRepeaterRepeaterIntCount) {try {using (VarContext =NewJgdjentities ()) {VarClassno =Context.Jy_news_classs.Where (n =N.Classcname = =ClassName).First ().Classno;VarNEWSS =Common.Getnewslistbycno (Encrypt.Md5encrypt (Classno));if (Anchor! =NULL) {Anchor.HRef ="/list.aspx?" Classno= "+Encrypt.Md5encrypt (CLASSNO); }Repeater.DataSource =Newss.Take (count);Repeater.DataBind (); } }catch (Exceptione) {}}#region Website VisitsProtectedvoidPageviews () {IntCount = 0;Data accumulationIntStat = 0;StreamReaderSrdGet the actual path to the fileStringFile_path =Server.MapPath ("/xml/counter.txt");Open a file for readingSRD =File.OpenText (File_path);while (Srd.Peek ()! =-1) {Stringstr =Srd.ReadLine ();Count =Int.Parse (STR); }Srd.Close ();Code to run when a new session is startedApplication.Lock ();Gets the total number of site visits saved in the Application objectStat =CountStat + = 1;Objectobj =Stat;application["Counter"] =ObjWriting data records to a fileStreamWriterSRW =new streamwriter (file_path, false); srw. WriteLine (srw. Close (); application. unlock (); }< Span style= "color: #1212f8;" > #endregion }}
My Code, written by Pagebase. Or keep it, is the core of this set of CMS. Semantically, just like my cloud platform, except that the cloud platform is written in JS. This is WebForm. Next, write Mvc. The core is simple.