Time of Update: 2017-01-19
mailhelper -------mail協助類複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mail;/// <summary>///mailhelper 的摘要說明/// </summary>public class mailhelper{
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;using System.
Time of Update: 2017-01-19
Asp.net是微軟.Net戰略的一個組成部分。它相對以前的Asp有了很大的發展,引入了許多的新機制。本文就Asp.net頁面的生命週期向大家做一個初步的介紹,以期能起到指導大家更好、更靈活地操縱Asp.net的作用。當一個擷取網頁的請求(可能是通過使用者提交完成的,也可能是通過超連結完成的)被發送到Web伺服器後,這個頁面就會接著運行從建立到處理完成的一系列事件。在我們試圖建立Asp.net頁面的時候,這個執行循環是不必去考慮的,那樣只會自討苦吃。然而,如果被正確的操縱,一個頁面的執行循環將是
Time of Update: 2017-01-19
Web.config 是一個基於 XML 的設定檔,該檔案的作用是對應用程式進行配置,比如規定客戶的認證方法,基於角色的安全技術的策略,資料綁 定的方法,遠端對象等。 可以在網站的根目錄和子目錄下分別建立自己的 Web.config 檔案,也可以一個Web.config 檔案都不建立,Web.config 並不是網站必備的檔案。這是因為伺服器有一個總 的設定檔,名為"Machine.config" ,預設安裝在"C:\Windows\Microsoft.NET\ Framework\(版本號碼)
Time of Update: 2017-01-19
首先是為DIV添加一個onscroll="javascript:setScollTop()" 的方法(當然不一定是DIV其他的標籤思路應該也是這樣的)複製代碼 代碼如下:<div style="overflow: auto; height: 152px" align="left" id="dvScoll_1"
Time of Update: 2017-01-19
做站的時候經常會遇到要產生縮圖的功能,因為可能不同的情況需要用來不同大小的縮圖。本文產生的圖片都為正方形,只有正方形的縮圖才是保證圖片足夠清晰。當我我這裡說的正方形是先按比例壓縮,然後加一個固定的白底 然後置中顯示。代碼:建立outputimg.ashx複製代碼 代碼如下://調整圖片大小private static Size NewSize(int maxWidth, int maxHeight, int Width, int
Time of Update: 2017-01-19
第一種: 複製代碼 代碼如下:private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二種:複製代碼 代碼如下:private void Button2_Click( object sender, System.EventArgs e )
Time of Update: 2017-01-19
在Web開發中會經常使用到個人資訊註冊,而個人資訊中通常需要自己的頭像或者照片。今天主要介紹一下使用FileUpload+img控制項上傳照片。 FileUpLoad控制項使用介紹 FileUpLoad控制項的PostedFile屬性主要擷取上傳檔案的一些基礎資訊。 .ContentLength 擷取上傳檔案的大小。傳回值為int類型,單位為位元組。 用途 1、判斷上傳檔案的大小 if (this.FileUpload1.PostedFile.ContentLength <= 400000
Time of Update: 2017-01-19
複製代碼 代碼如下:public partial class _Default : System.Web.UI.Page{ protected string title="大家好"; //前台代碼<title><%#title %></title>
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
通常的使用情境是當我們有某個頁面需要使用者登入才能訪問時,我們會在代碼中判斷當前訪問使用者是否登入,如果未登入,則重新導向至登入頁面,並將當前網址通過Url參數傳遞給登入頁面。如果使用了URL重寫,並通過Request.Url.AbsoluteUri擷取當前網址,使用者登入後開啟的就是重寫後的地址,這雖然不影響正常使用,但從使用者體驗及URL統一的角度,我們更希望是重寫前的地址。 之前,我們在開發中也被這個問題困擾,只能盡量通過js重新導向至登入頁面(通過location.href擷取當前
Time of Update: 2017-01-19
一、超級連結 從一個表單進入另一個表單最簡單的方式是使用HTML超級連結控制項。在Web表單中,使用超級連結的HTML代碼類如: 複製代碼 代碼如下:<a href="WebForm2.aspx">進入表單2</a> 當使用者點擊該超級連結,WebForm2.aspx執行並將結果發送到瀏覽器。超級連結導航方式幾乎可用於任何地方,包括HTML頁面和普通的ASP頁面。ASP.NET還提供了另一種可替換使用的方法,即HyperLink伺服器控制項: 複製代碼 代碼如下:<
Time of Update: 2017-01-19
ctlCalendar.ascx的原始碼:複製代碼 代碼如下:<%@ Control Language="c#" AutoEventWireup="false" Codebehind="ctlCalendar.ascx.cs" Inherits="calendar.ctlCalendar" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"
Time of Update: 2017-01-19
index.aspx複製代碼 代碼如下:<%@ Page Language="C#" %><%@ import Namespace="System.Data" %><%@ import Namespace="System.Data.OleDb" %><script runat="server"> // Insert page code here
Time of Update: 2017-01-19
Asp.net 中引入Javascript 的方法有很多。在做牛腩的時候主要講了兩種。 個人認為可以分為直接引入,和間接引入。一、直接引入。在前台頁面調用自訂的javascript 函數: 1、開啟前台頁面在 head 元素之間加入 script 元素,將 type 元素設定為 " text/javascript "。然後寫javascript自訂的函數。 複製代碼 代碼如下: <head runat="server"> <script
Time of Update: 2017-01-19
在WebConfig中設定資料庫連接字串,代碼如下: 複製代碼 代碼如下: <connectionStrings> <add name="ConnectionString" connectionString="user id=使用者名稱;password=密碼;initial catalog=資料庫名稱;data source=伺服器名稱"/> </connectionStrings>
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
複製代碼 代碼如下: /// <summary> /// 設定頁面不被緩衝 /// </summary> private void SetPageNoCache() { Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.Expires = 0; Response.CacheControl = "no-cache";
Time of Update: 2017-01-19
複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;using System.IO;using System.Resources;using System.Reflection;using System.Runtime.InteropServices;namespace newExtIcon{
Time of Update: 2017-01-19
複製代碼 代碼如下:public bool Add(Liuyan refmodel) { string sql = "insert into