Time of Update: 2017-01-18
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography;
Time of Update: 2017-01-18
/// <summary> /// 產生縮圖 /// </summary>
Time of Update: 2017-01-18
一..Net Framework 1. 如何獲得系統檔案夾 使用System.Envioment類的GetFolderPath方法;例如: Environment.GetFolderPath( Environment.SpecialFolder.Personal ) 2. 如何獲得正在執行的exe檔案的路徑 1) 使用Application類的ExecutablePath屬性
Time of Update: 2017-01-18
首先在App_GlobalResources建立resx資源檔。如: 不同語言的resx中項目應該具有相同的名稱: 中文資源項 英文資源項 完了以後就可以使用這些名值對了,複製代碼 代碼如下:<asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:lang,userinfo%>" /> 或者 複製代碼 代碼如下:<%=Resources.lang.userinfo%>
Time of Update: 2017-01-18
asp.net壓縮檔夾調用樣本:rar("e:/www.jb51.net/", "e:/www.jb51.net.rar"); asp.net解壓縮rar檔案調用樣本:unrar("e:/www.jb51.net.rar", "e:/"); 複製代碼 代碼如下: using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; namespace BLL { public
Time of Update: 2017-01-18
複製代碼 代碼如下:static string GetEncoding(string url) { HttpWebRequest request = null; HttpWebResponse response = null; StreamReader reader = null; try { request = (HttpWebRequest)WebRequest.Create(url); request.Timeout = 20000; request.AllowAutoRedirect =
Time of Update: 2017-01-18
複製代碼 代碼如下: using System; using System.Net; using System.Text; using System.Text.RegularExpressions; class Program { // 擷取網頁的HTML內容,根據網頁的charset自動判斷Encoding static string GetHtml(string url) { return GetHtml(url, null); } // 擷取網頁的HTML內容,指定Encoding
Time of Update: 2017-01-18
本文章主要介紹SqlHelper使用。 每個項目都要用到資料訪問層,我做的也不例外,但是我把資料訪問層做成獨立項目,沒有什麼太大的目的,資料訪問層,僅僅做資料訪問用,不包含任何邏輯。 為什麼要使用資料訪問層? 如果不使用資料訪問層,那麼你的代碼裡會出現很多SqlConnection、SqlCommand、SqlDataReader、Open、
Time of Update: 2017-01-18
以下都以ASP.NET開發網站為例。 1、sql注入漏洞。 解決辦法:使用預存程序,參數不要用字串拼接。簡單改進辦法:使用SqlHelper和OledbHelper 2、跨站指令碼漏洞 解決辦法:“預設禁止,顯式允許”的策略。具體參考:從用戶端檢測到有潛在危險的Request.Form值,禁止提交html標記(<>等被轉義成<) 3、上傳漏洞
Time of Update: 2017-01-18
複製代碼 代碼如下:<script language="JavaScript" type="text/javascript"> //測試瀏覽器類型// var Browser = new Object(); Browser.ua = window.navigator.userAgent.toLowerCase(); Browser.ie = /msie/.test(Browser.ua); Browser.moz = /gecko/.test(Browser.ua); /******
Time of Update: 2017-01-18
複製代碼 代碼如下:using System; using System.Web; using System.Web.UI; using System.Text.RegularExpressions; namespace STH.function { /// <summary> /// UbbCode 的摘要說明。 /// </summary> public class UbbCode { Root theroot=new Root(); HttpContext
Time of Update: 2017-01-18
一般進行替換操作都這樣:複製代碼 代碼如下:str=str.replace(字串一,字串二) 不難發現一個問題,如果str要迴圈替換很多次,下一次替換時會累加上上次替換的內容,並且全遍曆一次,如果字串二很多,替換的過程就像階梯效果,越來越大,所以速度越來越慢。要解決這個問題只能找另外的方法替換這種表達方式。 如何以更高效率代替這種操作? 思路如下: 每次替換完後,在下次替換時先排除這次替換的內容,累加本次替換的內容。複製代碼 代碼如下:public Regex
Time of Update: 2017-01-18
ASP.Net是建立在微軟新一代.Net平台架構上,利用普通語言運行時(Common Language Runtime)在伺服器後端為使用者提供建立強大的企業級Web應用服務的編程架構。下面列舉了常用的27個ASP.NET中的函數集: 1、DateTime 數字型 複製代碼 代碼如下: System.DateTime currentTime=new System.DateTime(); 1.1 取當前年月日時分秒 currentTime=System.DateTime.Now; 1.2
Time of Update: 2017-01-18
複製代碼 代碼如下: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-18
一、目前在ASP.NET中頁面傳值共有這麼幾種方式:1、表單提交,<form action= "target.aspx" method = "post" name = "form1"><input name = "param1" value = "11
Time of Update: 2017-01-18
問題:當一個正在執行中的ASPX頁面執行到一半的時候,瀏覽器中你關閉了這個頁面,伺服器端對應的這個頁面的代碼仍然在執行嗎? 答案:除非你代碼裡面做了特殊判斷,否則仍然正在執行。 注意點: 1、用戶端顯示頁面的時候,後台已經執行完了的頁面對象早已經不存在了。當然這時候談不上伺服器段執行不執行的問題了。 2、頁面還沒有返回,處於等待狀態的時候。關閉ASPX頁面,才會涉及到上面提到的伺服器端仍然在執行的情況。 3、用戶端關閉的時候根本不向伺服器發送指令。
Time of Update: 2017-01-18
複製代碼 代碼如下:protected void Page_Load(object sender, EventArgs e) { webinfo info = new webinfo();
Time of Update: 2017-01-18
先看介面:添加後資料庫:而所要執行的語句:複製代碼 代碼如下:string name_ = this.tbxUseName.Text.Trim(); string webname_ = this.tbxWebName.Text.Trim();
Time of Update: 2017-01-18
1、 foreach (Control c in this.rptTables.Controls) { CheckBox cbx = (CheckBox)c.FindControl("cbxId"); TextBox tbx = (TextBox)c.FindControl("tbxTableName"
Time of Update: 2017-01-18
常見的處理方法是,在使用者登入時,判斷此使用者是否已經在Application中存在,如果存在就報錯,不存在的話就加到Application中(Application是所有Session共有的,整個web應用程式唯一的一個對象): string strUserId = txtUser.Text; ArrayList list = Application.Get("GLOBAL_USER_LIST")