Time of Update: 2017-01-19
1.資料結構Mad_Popedom為許可權表,Control記錄控制器名,Action記錄動作名。Mad_Role為角色表。 2.許可權控制的實現此處使用比較簡單AOP方式,用MVC的Filter實現,代碼如下複製代碼 代碼如下:using System.Collections.Generic; using System.Web.Mvc; using Madnet.Model.MadAdmin; using Madnet.BLL.MadAdmin; namespace
Time of Update: 2017-01-19
比如 父頁面: 複製代碼 代碼如下: public class BasePage : System.Web.UI.Page { public int HotelID { get { return 1; } } } 子頁面: 複製代碼 代碼如下: public partial class UpdateAlbumAttachments : BasePage { public new int HotelID { get { return 0; } } }
Time of Update: 2017-01-19
整個程式的代碼如下: 複製代碼 代碼如下: using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI; /// <summary> /// 彈出JavaScript小視窗 /// </summary> /// <param name="js">視窗資訊</param> public static
Time of Update: 2017-01-19
向資料層、商務邏輯層、UI 或輸出層添加緩衝支援。記憶體現在非常便宜 — 因此,通過以智能的方式在整個應用程式中實現緩衝,可以獲得很大的效能提高。 緩衝可以掩蓋許多過失 緩衝是一種無需大量時間和分析就可以獲得“足夠良好的”效能的方法。這裡再次強調,記憶體現在非常便宜,因此,如果您能通過將輸出緩衝 30 秒,而不是花上一整天甚至一周的時間嘗試最佳化代碼或資料庫就可以獲得所需的效能,您肯定會選擇緩衝解決方案(假設可以接受 30 秒的舊資料)。緩衝正是那些利用 20% 付出獲得 80%
Time of Update: 2017-01-19
1.遍曆頁面中所有的TextBox,並將值設定成String.Empty 複製代碼 代碼如下: for (int j = 0; j < this.Controls.Count; j++) { foreach (object o in Page.Controls[j].Controls) { if (o is TextBox) { TextBox txt = (System.Web.UI.WebControls.TextBox)o; txt.Text = String.Empty; } }
Time of Update: 2017-01-19
複製代碼 代碼如下: public class XVPage : Page { static private DirectoryInfo _Dir; private DirectoryInfo Dir { get { if (_Dir == null) { _Dir = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data")); if (!_Dir.Exists) _Dir.Create(
Time of Update: 2017-01-19
方式1: 複製代碼 代碼如下: foreach (Control c in this.Repeater1.Controls) { HtmlInputCheckBox check = (HtmlInputCheckBox)c.FindControl("cbDelete1"); if( check != null ) { check.Checked = true; } } 方式2: 複製代碼 代碼如下: for (int i=0;i<this.Repeater1.Items.Count;i+
Time of Update: 2017-01-19
1、靜態模板頁面 template.html,主要是定義了一些特殊字元,用來被替換。 複製代碼 代碼如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;
Time of Update: 2017-01-19
個人喜歡用Repeater,因其簡潔,此AjaxPager定向為Repeater! 一步一步看來: 代碼 複製代碼 代碼如下: [DefaultProperty("TotalRecord"), ToolboxData("<{0}:AjaxPager runat=server></{0}:AjaxPager>")] public class AjaxPager : WebControl,ICallbackEventHandler { public AjaxPager() :
Time of Update: 2017-01-19
asp函數代碼:複製代碼 代碼如下:function checkip(checkstring)'用正則判斷IP是否合法dim re1set re1=new RegExpre1.pattern=”^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$”re1.global=falsere1.Ignorecase=falsecheckip=re1.test(checkstring)set re1=nothingend functionfunction
Time of Update: 2017-01-19
第一步,先做好搜尋網頁面 複製代碼 代碼如下: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
Time of Update: 2017-01-19
STATS命令 遍曆memcached緩衝對象(C#)轉載之青草堂 出於效能考慮,memcached沒有提供遍曆功能,不過我們可以通過以下兩個stats命令得到所有的緩衝對象。 1、stats items 顯示各個slab中item的數目。 2、stats cachedump slab_id limit_num 顯示某個slab中的前limit_num個key列表,顯示格式:ITEM key_name [ value_length b; expire_time|access_time s]
Time of Update: 2017-01-19
靜態頁面 staticHtml.html 複製代碼 代碼如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>
Time of Update: 2017-01-19
開發環境IIS7下一切正常,但是部署到IIS6伺服器以後, 每次重新整理頁面總出現Ajax用戶端不能載入的問題. 複製代碼 代碼如下: protected void Application_AcquireRequestState(object sender, EventArgs e) { string oldToken = Session["token"].ToString(); } MSDN上說: Application_AcquireRequestState,
Time of Update: 2017-01-19
在ASP.NET包含檔案的方法有: 1.<% Response.WriteFile("skin/default/footer.txt")%> 2.<% server.execute("skin/default/footer.txt")%> 3.StreamReader 對象將包含檔案寫到 HTTP 內容流中 //me:網上說asp.net中用include也可以的。。 include和Server.Execute有什麼區別?
Time of Update: 2017-01-19
aspx 頁面與ascx使用者控制項傳值的問題 1.建立ascx控制項 2.給ascx加上屬性 3.將控制項拖入aspx中 4.在aspx的代碼中按控制項ID訪問屬性 如: <uc3:left_Repassword ID="left_Repassword1" runat="server" /> left_Repassword1.HighLight = value; 也同樣適用於master頁面訪問ascx
Time of Update: 2017-01-19
類比的POST請求也一樣。但有時可能類比POST資料格式不是很標準(可能吧,沒太細研究),在服務端是擷取不到資料的。最近就遇到了這麼一個麻煩的事,資料是一個合作方通過類比POST的。
Time of Update: 2017-01-19
主要用於不經常更新和修改,而在第一次編譯是時要經過大量處理的資料。網頁輸出快取是緩衝的整個頁面 使用很簡單<%@ OutPutCache Duration="60" VaryByParam="none"%> Duration:緩衝時間 VaryByParam:通過參數來更新緩衝的內容 還有其他的一些屬性 CacheProfile:調用WebConfig中的緩衝時間 例如:WebCofig中 複製代碼 代碼如下: <system.web>
Time of Update: 2017-01-19
只一行代碼: 複製代碼 代碼如下: <tr style="<%# (Container.DisplayIndex%2==0)?"background-color:white;":"background-color:#EEEEEE;" %>"> 另外還有直接用js處理整個頁面中所有tr的交替色: 複製代碼 代碼如下: <html> <head> <meta http-equiv="Content-Type"
Time of Update: 2017-01-19
ASP.NET操作事務非常的簡單,代碼如下: 代碼 複製代碼 代碼如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Transactions;