asp.netÖлùÓÚFormÑéÖ¤µÄ½ÇÉ«ÊÚȨÑéÖ¤
ÒÔÏÂÀàÈÝΪתÔØ£¬µ«ÊDz»ÖªµÀÊÇʲôÔÒò£¬¾±¾È˲âÊÔÕâ¸ö·½·¨ÓÐÒ»¸öbug£¬°´ÕÕÒÔÏÂÀàÈÝËùÉè¼ÆµÄ½ÇÉ«ÑéÖ¤²»Äܳɹ¦¡£Application_AuthorizeRequestʼþ¸ÄΪApplication_AuthenticateRequestʼþ²ÅÄÜʵÏÖ¡£
Asp.netµÄÉí·ÝÑéÖ¤ÓÐÓÐÈýÖÖ£¬·Ö±ðÊÇ"Windows | Forms | Passport"£¬ÆäÖÐÓÖÒÔFormsÑéÖ¤ÓõÄ×î¶à£¬Ò²×îÁé»î¡£
Forms ÑéÖ¤·½Ê½¶Ô»ùÓÚÓû§µÄÑéÖ¤ÊÚȨÌṩÁ˺ܺõÄÖ§³Ö£¬¿ÉÒÔͨ¹ýÒ»¸öµÇ¼ҳÃæÑéÖ¤Óû§µÄÉí·Ý£¬½«´ËÓû§µÄÉí·Ý·¢»Øµ½¿Í»§¶ËµÄCookie£¬Ö®ºó´ËÓû§ÔÙ·ÃÎÊÕâ¸öwebÓ¦ÓþͻáÁ¬Í¬Õâ¸öÉí·ÝCookieÒ»Æð·¢Ë͵½·þÎñ¶Ë¡£·þÎñ¶ËÉϵÄÊÚȨÉèÖþͿÉÒÔ¸ù¾Ý²»Í¬Ä¿Â¼¶Ô²»Í¬Óû§µÄ·ÃÎÊÊÚȨ½øÐпØÖÆÁË¡£
ÎÊÌâÀ´ÁË£¬ÔÚʵ¼ÊÊÇÓÃÖÐÎÒÃÇÍùÍùÐèÒªµÄÊÇ»ùÓÚ½ÇÉ«£¬»òÕß˵»ùÓÚÓû§×éµÄÑéÖ¤ºÍÊÚȨ¡£¶ÔÒ»¸öÍøÕ¾À´Ëµ£¬Ò»°ãµÄÑéÖ¤ÊÚȨµÄģʽӦ¸ÃÊÇÕâÑùµÄ£º¸ù¾Ýʵ¼ÊÐèÇó°ÑÓû§·Ö³É²»Í¬µÄÉí·Ý£¬¾ÍÊǽÇÉ«£¬»òÕß˵ÊÇÓû§×飬ÑéÖ¤¹ý³Ì²»µ«ÒªÑéÖ¤Õâ¸öÓû§±¾ÉíµÄÉí·Ý£¬»¹ÒªÑéÖ¤ËüÊÇÊôÓÚÄĸö½ÇÉ«µÄ¡£¶ø·ÃÎÊÊÚȨÊǸù¾Ý½ÇÉ«À´ÉèÖõģ¬Ä³Ð©½ÇÉ«¿ÉÒÔ·ÃÎÊÄÄЩ×ÊÔ´£¬²»¿ÉÒÔ·ÃÎÊÄÄЩ×ÊÔ´µÈµÈ¡£ÒªÊÇ»ùÓÚÓû§À´ÊÚȨ·ÃÎʽ«»áÊǸöºÜ²»Êµ¼ÊµÄ×ö·¨£¬Óû§Óкܶ࣬»¹¿ÉÄÜËæʱµÄÔö¼õ£¬²»¿ÉÄÜÔÚÅäÖÃÎļþÖÐËæʱµÄΪ²»¶ÏÔö¼ÓµÄÐÂÓû§È¥Ôö¼Ó·ÃÎÊÊÚȨµÄ¡£
ÏÂÃæ´ó¸ÅµÄ¿´Ò»ÏÂFormsµÄ¹ý³Ì¡£
FormsÉí·ÝÑéÖ¤»ù±¾ÔÀí£º
Ò» Éí·ÝÑéÖ¤
Òª²ÉÓÃFormsÉí·ÝÑéÖ¤£¬ÏÈÒªÔÚÓ¦ÓóÌÐò¸ùĿ¼ÖеÄWeb.configÖÐ×öÏàÓ¦µÄÉèÖÃ:
<authentication mode="forms">
<forms name=".ASPXAUTH " loginUrl="/login.aspx" timeout="30" path= "/">
</forms>
</authentication>
ÆäÖÐ<authentication mode= "forms"> ±íʾ±¾Ó¦ÓóÌÐò²ÉÓÃFormsÑéÖ¤·½Ê½¡£
1. <forms>±êÇ©ÖеÄname±íʾָ¶¨ÒªÓÃÓÚÉí·ÝÑéÖ¤µÄ HTTP Cookie¡£Ä¬ÈÏÇé¿öÏ£¬name µÄÖµÊÇ .ASPXAUTH¡£²ÉÓôËÖÖ·½Ê½ÑéÖ¤Óû§ºó,ÒÔ´ËÓû§µÄÐÅÏ¢½¨Á¢Ò»¸öFormsAuthenticationTicketÀàÐ͵ÄÉí·ÝÑé֤Ʊ,ÔÙ¼ÓÃÜÐòÁл¯ÎªÒ»¸ö×Ö·û´®,×îºó½«Õâ¸ö×Ö·û´®Ð´µ½¿Í»§¶ËµÄnameÖ¸¶¨Ãû×ÖµÄCookieÖÐ.Ò»µ©Õâ¸öCookieдµ½¿Í»§¶Ëºó,´ËÓû§ÔٴηÃÎÊÕâ¸öwebÓ¦ÓÃʱ»á½«Á¬Í¬CookieÒ»Æð·¢Ë͵½·þÎñ¶Ë,·þÎñ¶Ë½«»áÖªµÀ´ËÓû§ÊÇÒѾÑéÖ¤¹ýµÄ.
ÔÙ¿´Ò»ÏÂÉí·ÝÑé֤Ʊ¶¼°üº¬ÄÄЩÐÅÏ¢ÄØ,ÎÒÃÇ¿´Ò»ÏÂFormsAuthenticationTicketÀà:
CookiePath£º ·µ»Ø·¢³ö Cookie µÄ·¾¶¡£×¢Ò⣬´°ÌåµÄ·¾¶ÉèÖÃΪ /¡£ÓÉÓÚ´°ÌåÇø·Ö´óСд£¬ÕâÊÇΪÁË·ÀÖ
Ïà¹ØÎĵµ£º
Ê×Ò³£º
<%@ 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" >
<head ......
//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//Êý¾Ý¿âµØÖ·
private string datapatch = "db/global.asa";//Êý¾Ý¿âµØÖ·
///
/// È¡µÃdataset
//
/// ²éѯÓï¾ä
///
public DataSet GetDataSet(string Commandtext)
{&nbs ......
http://hi.baidu.com/%E5%EB%B3%DF%C8%CB%C9%FA/blog/item/58a1540bbf0bb437b1351d9a.html
#region DataGridViewÊý¾ÝÏÔʾµ½Excel
/// <summary>
/// ´ò¿ªExcel²¢½«DataGridView¿Ø¼þÖÐÊý¾Ýµ¼³öµ½Excel
/// </summary>
/// <param name="dgv">DataGridView¶ÔÏó </param>
/// <param na ......
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.Data.OracleClient;//ÒýÈëÃüÃû¿Õ¼ä ......
1 Ä¿µÄ
2 ·¶Î§
3 ×¢Ê͹淶
3.1 ¸ÅÊö
3.2 ×Ô½¨´úÂëÎļþ×¢ÊÍ
3.3 Ä£¿é£¨ÀࣩעÊÍ
3.4 ÀàÊôÐÔ×¢ÊÍ
3.5 ·½·¨×¢ÊÍ
3.6 ´úÂë¼ä×¢ÊÍ
4   ......