Time of Update: 2017-01-19
複製代碼 代碼如下: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
Time of Update: 2017-01-19
重新整理的實現方法: =========================================== .net //第1: /*-- 內建跳轉 ----*/ Response.Redirect( Request.Url.ToString( ) ); //第2: /*----內建 html ----*/ Response.AddHeader( "Refresh","0" ); //將指定的標題和值添加到此響應的 HTTP 標題。 //第3: Response.Write( "
Time of Update: 2017-01-19
方法一: Home/Index.aspx中的代碼 複製代碼 代碼如下: <% using (Html.BeginForm("up","Home",FormMethod.Post,new{enctype="multipart/form-data"})) {%> <input type="file" name="upfile" /> <input type ="submit" name ="upload" value ="上傳" /> <%} %>
Time of Update: 2017-01-19
在網上搜了一下事件執行順序,並經過測試在有分頁的情況下是不正確的。事件執行順序: 一、GridView 顯示繫結資料(預設為5行): 複製代碼 代碼如下: DataBinding RowCreated:Header[0] RowDataBound RowCreated:DataRow[1] RowDataBound RowCreated:DataRow[2] RowDataBound RowCreated:DataRow[3] RowDataBound RowCreated:DataRow[4]
Time of Update: 2017-01-19
IIS收到請求-->ISAPI用於處理該請求-->BeginRequest開始-->EndRequest結束-->輸出Response 中間有好多其它的流程就不標記了,這裡只是列出URLRewrite所走的流程。 其實就是在BeginRequest事件中調用HttpContext的RewritePath方法,將該請求重新“定位”至一個目標URL就完成了。 在網站的Global.asax檔案BeginRequest方法中添加代碼: 複製代碼 代碼如下: public
Time of Update: 2017-01-19
問題:大家都說使用 forms 驗證無法得到當前登入使用者除了使用者名稱之外的更多資訊,經過我的一番小實驗,在 forms 方式下內建的 userdata 可以為我們施展天地的地方。下面記錄一下我的操作步驟備忘。 step 1: web.config 配置關鍵地方: web.config配置 複製代碼 代碼如下: <!-- 通過 <authentication> 節可以配置 ASP.NET 用來 識別進入使用者的 安全身分識別驗證模式。 -->
Time of Update: 2017-01-19
前台代碼: 複製代碼 代碼如下: <asp:GridView ID="GridLog" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" BorderColor="#333" BorderStyle="solid" BorderWidth="1" OnRowDeleting="PublicGridRowDeleting" GridLines="None" Width="98%"
Time of Update: 2017-01-19
複製代碼 代碼如下: using System; using System.Data; using System.Configuration; 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;
Time of Update: 2017-01-19
ASP.net 獲得用戶端的IP,最常見的是使用下述代碼: 複製代碼 代碼如下: string user_IP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; 對於瞭解Proxy 伺服器情況的人,我們會知道,如果使用者使用了Proxy 伺服器,上述代碼獲得的是Proxy 伺服器的IP地址;如果使用者使用了多個Proxy 伺服器,則是到達伺服器的最後一個Proxy 伺服器的IP地址。 REMOTE_
Time of Update: 2017-01-19
1、OWC11 這個控制項全稱是:Office Web Component 11,是office2003中的一個組件,可惜的是office2007中沒有了它的身影。不過安裝office2003之後可以引用,然後使用。使用過的人都知道,就是它的效果要差一點。 2、dotnetCharting http://www.dotnetcharting.com/ &
Time of Update: 2017-01-19
但是我在使用過程中,發現針對角色的控制並不是那麼容易,通過在網上尋找資料,終於解決這個問題。下面將主要的注意事項列出來。1、設定檔中,角色的allow項要放在deny項的前面,users要配置為*,而不是? 代碼 複製代碼 代碼如下: <location path="Doctors"> <system.web> <authorization> <allow roles="doctors"/> //這個在前 <deny
Time of Update: 2017-01-19
3種方法分別是: string a=""; 1.if(a=="") 2.if(a==String.Empty) 3.if(a.Length==0) 3種方法都是等效的,那麼究竟那一種方法效能最高呢?本人用實驗說明問題。 建立3個aspx頁面(為什麼用網頁,主要是利用Microsoft Application Center Test ) WebForm1.aspx 複製代碼 代碼如下: private void Page_Load(object sender, System.EventArgs
Time of Update: 2017-01-19
複製代碼 代碼如下:public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 對於C#的隨機數,沒什麼好說的 System.Threading.Thread.Sleep(RandomNum_First.Next(50)); Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks); //
Time of Update: 2017-01-19
效能方面 Repeater比DataList要好一些,如果不是很大資料量的話,這點差別是體現不來的。 易用性方面 Repeater與DataList背景資料繫結都很簡單,DataSource=... DataBind()就OK了
Time of Update: 2017-01-19
--前台 複製代碼 代碼如下: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Successed.aspx.cs" Inherits="Biz_Order_Successed" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.
Time of Update: 2017-01-19
比如每天淩晨七點的時候email發送一次報表。 這裡首先想到的就是利用 Global.asax 檔案來實現, 以下Global檔案的內容。 複製代碼 代碼如下: <%@ Application Language="C#" %> <%@ Import Namespace="System.Threading" %> <script runat="server"> //這裡使用靜態保持對這處Timer執行個體的引用,以免GC private static
Time of Update: 2017-01-19
在html頁中,定義了TextBox控制項, 複製代碼 代碼如下: <td align="center" style="width: 183px; height: 25px"> 緯度:<asp:TextBox ID="TextBox_l" runat="server" Width="76px"></asp:TextBox> 經度:<asp:TextBox ID="TextBox_2" runat="server" Width="95px"><
Time of Update: 2017-01-19
複製代碼 代碼如下: #region 方法一: DataTable tblDatas = new DataTable("Datas"); DataColumn dc = null; dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32")); dc.AutoIncrement = true;//自動增加 dc.AutoIncrementSeed = 1;//起始為1 dc.AutoIncrementStep = 1;//步長為1
Time of Update: 2017-01-19
複製代碼 代碼如下: if (!IsPostBack) { //一級分類列表 this.DropDownList1.DataSource = dsbb.SelectSubjct1(); this.DropDownList1.DataTextField = "cName"; this.DropDownList1.DataValueField = "Ccode"; this.DropDownList1.DataBind();
Time of Update: 2017-01-19
複製代碼 代碼如下:using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using