Time of Update: 2017-01-19
之前覺得這個話題已經被談濫了。URL Rewrite早已經被廣大開發人員所接受,網上關於URL Rewrite的組件和文章也層出不窮,但是總是讓我感覺意猶未盡,於是最終還是忍不住提筆寫了這系列文章。這些文章不會談論URL Rewrite的價值與意義,而只會談論純技術的內容。文章中也不會有詳盡地實現分析,而是結合了我的經驗,從應用角度來講解這個話題。您已經知道的,您還不知道的,別處已經講過的,或者還沒有講過的,希望這系列文章的“舊事重提”不會讓您覺得沉悶,並且能讓您瞭解ASP.NET中URL
Time of Update: 2017-01-19
上一篇部落格中有些沒有考慮到的東西這次更改一下代碼如下: 介面前台: 複製代碼 代碼如下: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdmShowDIV.aspx.cs" Inherits="ExamSystemV3.Manager.RoleManager.AdmShowDIV" %> <!DOCTYPE html> <html
Time of Update: 2017-01-19
1.Session是一種Web會話中的常用狀態之一。2.Session提供了一種把資訊儲存在伺服器記憶體中的方式。他能儲存任何資料類型,包含自訂對象。3.每個用戶端的Seesion是隔離儲存區 (Isolated
Time of Update: 2017-01-19
正常的引用複製代碼 代碼如下:<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="AjaxToolKit" %><asp:TextBox ID="txtRecordTime" runat="server" cssclass="style"
Time of Update: 2017-01-19
複製代碼
Time of Update: 2017-01-19
實現代碼複製代碼 代碼如下:/// <summary> /// 產生驗證碼圖片,儲存session名稱VerificationCode /// </summary> public static void CreateVerificationCode()
Time of Update: 2017-01-19
1:建立報表所需的數據源DataSet.cs複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Data;namespace ********{ public class DataSet
Time of Update: 2017-01-19
類庫檔案我們在檔案最後面下載【ThoughtWorks.QRCode.dll 就是類庫】使用時需要增加:複製代碼 代碼如下:using ThoughtWorks.QRCode.Codec;using ThoughtWorks.QRCode.Codec.Data;using ThoughtWorks.QRCode.Codec.Util;主要原始碼:1.產生二維碼複製代碼 代碼如下:QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); String
Time of Update: 2017-01-19
浮水印是為了防止別盜用我們的圖片. 兩種方式實現浮水印效果1)可以在使用者上傳時添加浮水印.a) 好處:與2種方法相比,使用者每次讀取此圖片時,伺服器直接發送給客戶就行了.b) 缺點:破壞了原始圖片.2)通過全域的一般處理常式,當使用者請求這張圖片時,加浮水印.a) 好處:原始圖片沒有被破壞b)
Time of Update: 2017-01-19
在設定檔中配置404頁面如下: 複製代碼 代碼如下: <customErrors mode="On" defaultRedirect="404.aspx"> <error statusCode="403" redirect="404.aspx" /> <error statusCode="404" redirect="404.aspx" /> <error statusCode="400" redirect="404.aspx" />
Time of Update: 2017-01-19
網上好些代碼的原理大致與此類似,同樣都存在一個問題,就是: 類型“GridView”的控制項“ctl00_center_GridView1”必須放在具有 runat=server 的表單標記內。 說明: 執行當前 Web 請求期間,出現未處理的異常。請檢查堆疊追蹤資訊,以瞭解有關該錯誤以及代碼中導致錯誤的出處的詳細資料。 異常詳細資料:System.Web.HttpException: 類型“GridView”的控制項“ctl00_center_GridView1”必須放在具有
Time of Update: 2017-01-19
<%# Bind("Subject") %> //綁定欄位<%# Container.DataItemIndex + 1%> //實現自動編號<%# DataBinder.Eval(Container.DataItem, "[n]") %>通常使用的方法(這三個效能最好)<%# DataBinder.Eval(Container.DataItem, "ColumnName") %><%#
Time of Update: 2017-01-19
WebForm_1.aspx內容如下: 複製代碼 代碼如下: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_1.aspx.cs" Inherits="頁面傳值.WebForm_1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Time of Update: 2017-01-19
在 ASP.NET MVC 4 中可捆綁多個 css 和 js 檔案以減少HTTP請求,並對 css 和 js 檔案進行壓縮(縮小),這樣可提高網站的載入速度。我們選取部落格園的 css 檔案來看看,在 ASP.NET MVC 4 前,我們引入 css 方法如下: 複製代碼 代碼如下: <link href="/Content/Site.css" rel="stylesheet" type="text/css" /> <link href="/Content/sitehome.
Time of Update: 2017-01-19
1、Session2、驗證碼YZM.ashx複製代碼 代碼如下:<%@ WebHandler Language="C#" Class="YZM" %>using System;using System.Web;public class YZM : IHttpHandler, System.Web.SessionState.IRequiresSessionState{ public void ProcessRequest (HttpContext
Time of Update: 2017-01-19
1、資料繫結combox-->BingdSource-->ObjectDataSource//串連資料庫**後台代碼:T_UserTableAdapter adpter=T_UserTableAdpter();adpater.調用T_User表的自訂方法 //設定初始資料:AppenddateBource="true"; 2、Repeater
Time of Update: 2017-01-19
在類庫中建Http Handler的操作很簡單,就是添加一個普通的類,然後把之前ashx裡的代碼幾乎一模一樣貼到這個類中。但要注意命名空間和類名,因為之後我們會用 到。範例Handler:複製代碼 代碼如下:namespace EdiBlog.Core.Web.HttpHandlers{ using System; using System.Web; public class
Time of Update: 2017-01-19
1、CKEditor原名FckEditor,著名的HTML編輯器,可以線上編輯HTML內容。自己人用CKEditor,網友用UBBEditor。 配置參考文檔,主要將ckeditor中的(adapters、images、lang、plugins、skins、themes、ckeditor.js、config.js、contents.css)解壓到js目錄,然後“顯示所有檔案”,將ckeditor的目錄“包含在項目中”,在發帖頁面引用ckeditor.js,
Time of Update: 2017-01-19
url重寫的好處:1,方便搜尋引擎檢索到(html格式的網站搜尋引擎記住的優先順序最高,seo最佳化更好)2,url更加簡潔,方便使用者記憶3,隱藏網頁的實際路勁和具體開發技術使用URLRewriter.dll重寫使用URLRewriter.dll後,只需要使用如下步驟將可以進行url重寫1,在webconfig下寫入複製代碼 代碼如下:<Rules> <!-- 規則1 -->
Time of Update: 2017-01-19
為Button或其他控制項加上下面兩個屬性即可1.UseSubmitBehavior="false"使用伺服器端提交機制,即執行OnClick事件。 2.OnClientClick用戶端點擊按鈕後,設定控制項為不可用,控制項文本顯示處理中…,待伺服器端執行完OnClick事件,控制項自動回復為可用。 代碼如下: 複製代碼 代碼如下: UseSubmitBehavior="false" OnClientClick="this.disabled=true;this.value='處理中…';"