ѧϰasp.net C#
1¡¢DateTime Êý×ÖÐÍ
System.DateTime currentTime=new System.DateTime();
¡¡¡¡1.1 È¡µ±Ç°ÄêÔÂÈÕʱ·ÖÃë
currentTime=System.DateTime.Now;
¡¡¡¡1.2 È¡µ±Ç°Äê
int Äê=currentTime.Year;
¡¡¡¡1.3 È¡µ±Ç°ÔÂ
int ÔÂ=currentTime.Month;
¡¡¡¡1.4 È¡µ±Ç°ÈÕ
int ÈÕ=currentTime.Day;
¡¡¡¡1.5 È¡µ±Ç°Ê±
int ʱ=currentTime.Hour;
¡¡¡¡1.6 È¡µ±Ç°·Ö
int ·Ö=currentTime.Minute;
¡¡¡¡1.7 È¡µ±Ç°Ãë
int Ãë=currentTime.Second;
¡¡¡¡1.8 È¡µ±Ç°ºÁÃë
int ºÁÃë=currentTime.Millisecond;
£¨±äÁ¿¿ÉÓÃÖÐÎÄ£©
¡¡¡¡1.9 È¡ÖÐÎÄÈÕÆÚÏÔʾ——ÄêÔÂÈÕʱ·Ö
string strY=currentTime.ToString( "f "); //²»ÏÔʾÃë
¡¡¡¡1.10 È¡ÖÐÎÄÈÕÆÚÏÔʾ_ÄêÔÂ
string strYM=currentTime.ToString( "y ");
¡¡¡¡1.11 È¡ÖÐÎÄÈÕÆÚÏÔʾ_ÔÂÈÕ
string strMD=currentTime.ToString( "m ");
¡¡¡¡1.12 È¡µ±Ç°ÄêÔÂÈÕ£¬¸ñʽΪ£º2003-9-23
string strYMD=currentTime.ToString( "d ");
¡¡¡¡1.13 È¡µ±Ç°Ê±·Ö£¬¸ñʽΪ£º14£º24
string strT=currentTime.ToString( "t ");
¡¡¡¡2¡¢×Ö·ûÐÍת»» תΪ32λÊý×ÖÐÍ
¡¡¡¡Int32.Parse(±äÁ¿) Int32.Parse( "³£Á¿ ")
¡¡¡¡3¡¢ ±äÁ¿.ToString()
¡¡¡¡×Ö·ûÐÍת»» תΪ×Ö·û´®
¡¡¡¡12345.ToString( "n "); //Éú³É 12,345.00
¡¡¡¡12345.ToString( "C "); //Éú³É £¤12,345.00
¡¡¡¡12345.ToString( "e "); //Éú³É 1.234500e+004
¡¡¡¡12345.ToString( "f4 "); //Éú³É 12345.0000
¡¡¡¡12345.ToString( "x "); //Éú³É 3039 (16½øÖÆ)
¡¡¡¡12345.ToString( "p "); //Éú³É 1,234,500.00%
¡¡¡¡4¡¢±äÁ¿.Length Êý×ÖÐÍ
¡¡¡¡È¡×Ö´®³¤¶È
Ïà¹ØÎĵµ£º
ÕâÊÇÒ»¸öÓйطÖÒ³µÄʵÀý,½ö¹©²Î¿¼(´úÂëÀ´×ÔÍøÂç)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
using System.Threading;
using System.Collections;
us ......
asp.netÖГÏß³ÌÕý±»ÖÐÖ¹”Òì³£µÄ½â¾ö·½·¨
ÔÚÏîÄ¿À︺ÔðÒì³£´¦Àí²¿·Ö£ºÒì³£ÐÅÏ¢µÄдÈ룬¶ÁÈ¡£¬²é¿´£¬Òò´Ë¾Í¿ÉÒÔ¿´µ½¸÷ÖÖÒì³££¬ÊÜÒæ·Ëdz
¿´µ½ÓÐN¶àµÄ“Ïß³ÌÕý±»ÖÐÖ¹”Òì³££¬¶øÇÒÀ´×Ôͬһ¸öÒ³Ãæ¡£
System.Threading.ThreadAbortException: Ïß³ÌÕý±»ÖÐÖ¹¡£
at System.Threading.Thread.AbortInternal( ......
·½·¨1:
±ÈÈ罨Á¢Ò»¸öÃûΪcnlive£¬ÖµÎª"123"µÄcookie
HttpCookie cookie = new HttpCookie["cnlive"];
cookie.Value = "123";
Response.AppendCookie(cookie);
È¡¸Õ²ÅдÈëµÄCookieÖµ:
HttpCookie cookie = Request.Cookies["cnlive"];
cookieValue = cookie.Value;
ÔÚÒ»¸öCookieÖд¢´æ¶à¸öÐÅÏ¢:
HttpCookie cookie ......
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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" & ......
Ó°ÏìASP.NetÓ¦ÓÃÐÔÄܵÄÅäÖÃ
1¡¢É¾³ý²»±ØÒªµÄHttpModule£¬Ã¿Ôö¼ÓÒ»¸öHttpModule£¬Ã¿¸öÇëÇó´¦Àí¾Í¶àÒ»µã¿ªÏú¡£
È磺
<httpModules>
& ......