¶¨ÒåºÍʹÓÃASP.NET Profile(¸½Àý)
1¡¢Ë«»÷Ò»¸öÊý¾ÝÔ´¿Ø¼þ£¬½«Òª´æ´¢profileµÄÊý¾Ý¿â×÷ΪÊý¾ÝÔ´¼ÓÈë¿Ø¼þ£¨Õâ¸ö²½ÖèûʲôÓã¬Ö»ÊÇΪÁË·½±ã´ó¼ÒÓÿؼþ½¨Á¢Á¬½Ó£¬ÕâÑù²»ÈÝÒ׳ö´í£©£¬½¨Á¢ºÃÖ®ºó½«designÒ³ÃæµÄÊý¾ÝÔ´¿Ø¼þɾ³ý£¬Äã»á·¢ÏÖÔÚweb.configÀﻹÊÇÓÐÒ»ÌõÁ¬½ÓÓï¾ä£¬²»ÒªÉ¾³ý£¬ÎÒÃÇÏÂÃ潫Óõ½Ëü£¬È磺 <connectionStrings>
<add name="aspnetdbConnectionString" connectionString="Data Source=JAMESSHENG;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
2¡¢¶¨ÒåProfile,ÔÚÔ´ÂëÖмÓÈë
<profile enabled="true" automaticSaveEnabled="true" defaultProvider="SqlProvider">
<providers>
<clear/>
<add name="sqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="aspnetdbConnectionString" applicationName="ProfileSample" description="Sample for asp.net Profile and Profile Service"/>
</providers>
<properties>
<add name="BackGroudColor" type="System.String" allowAnonymous="true"/>
</properties>
</profile>
<anonymousIdentification enabled="true"/>
//defaultproviderÖ¸¶¨Ä¬ÈÏÅäÖÃÎļþÌṩ³ÌÐòµÄÃû³Æ
automaticSaveEnabledÖ¸¶¨Óû§ÅäÖÃÎļþÊÇ·ñÔÚ ASP.NET Ò³Ö´ÐнáÊøʱ×Ô¶¯±£´æ¡£Èç¹ûΪtrue£¬ÔòÓû§ÅäÖÃÎļþÔÚ ASP.NET Ò³Ö´ÐнáÊøʱ×Ô¶¯±£´æ¡£
providers(¿ÉÑ¡ÔªËØ)¶¨ÒåÅäÖÃÎļþÌṩ³ÌÐòµÄ¼¯ºÏ,Ëüµ±Öаüº¬<add> :name = defaultProviderµÄÖµ;type = System.Web.Profile.SqlProfileProviderÊÇʹÓÃsql;connectionStringName = aspnetdbConnectionStringʹÓÃÉÏÃæÁ¬½ÓÖж¨ÒåµÄÁ¬½Ó×Ö·û´®;
properties(±ØÑ¡µÄÔªËØ)¶¨ÒåÓû§ÅäÖÃÎļþÊôÐÔºÍÊôÐÔ×éµÄ¼¯ºÏ,Ëüµ±Öаüº¬<add>:name=“BackGroudColor”¶¨ÒåProfileÖеÄÊôÐÔÃû³Æ;type="System.String"×Ö·û´®ÀàÐÍ;allowAnonymous="true"¶¨ÒåÊÇ·ñ±£´æÄäÃûÓû§ÅäÖÃ,Èç¹ûÔÚ´Ë´¦¶¨Òåtrue£¬ÔòÔÚºóÃæ±ØÐë¼ÓÈë<anonymousIdentification>ÅäÖÃ,Éè
Ïà¹ØÎĵµ£º
ÔÚASP.NET³öÏÖ´íÎóʱ£¬Ó¦¸ÃÏȼì²éASP.NET»·¾³ÊÇ·ñÕýÈ·´î½¨£¬±ÈÈçÒÔϼ¸¸ö·½Ã棺
1¡¢ÊÇ·ñ°²×°ÏàÓ¦°æ±¾µÄ.NET Framework³ÌÐò£¬²¢´òºÃÁ˲¹¶¡¡£
2¡¢IISÊÇ·ñ°²×°ÔËÐÐÕý³££¬Õ¾µã·¾¶¼°ASP.NET°æ±¾ÊÇ·ñÅäÖÃÕýÈ·¡£
3¡¢ÔÚIIS WEB·þÎñÀ©Õ¹ÖУ¬ÊÇ·ñÔÊÐíÁËASP.NETÀ©Õ¹¡£
4¡¢ÊÇ·ñÓа²È«·À»¤Èí¼þ½ûÖ¹ÏòWindowsºÍTempÎļþ¼ÐдÈëÎÄ ......
ASP.NET 2.0
Îļþ£±: Deafault.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">
&l ......
Ò»¡¢SqlDataReadºÍDatasetµÄÑ¡Ôñ
SqldatareadÓŵ㣺¶ÁÈ¡Êý¾Ý·Ç³£¿ì¡£Èç¹û¶Ô·µ»ØµÄÊý¾Ý²»Ðè×ö´óÁ¿´¦ÀíµÄÇé¿öÏ£¬½¨ÒéʹÓÃSqlDataReader£¬ÆäÐÔÄÜÒª±ÈdatsetºÃºÜ¶à¡£È±µã£ºÖ±µ½Êý¾Ý¶ÁÍê²Å¿ÉcloseµôÓÚÊý¾Ý¿âµÄÁ¬½Ó
(SqlDataReader ¶ÁÊý¾ÝÊÇ¿ìËÙÏòÇ°µÄ¡£SqlDataReader ÀàÌṩÁËÒ»ÖÖ¶ÁÈ¡´Ó SQL Server
Êý¾Ý¿â¼ìË÷µÄÖ»½øÊý¾ÝÁ÷µ ......
ÎÒÏëÔÚaspÖмÓÒ»¸öÁ´½Ó£¬Ö¸Ïòasp.netÍøÒ³£¬µ«asp.netµÄÍøÖ·ÊǾ¹ýHttpUtility.UrlEncode±äÐκÍHttpUtility.UrlDecode±ä»ØµÄ£¬¶øaspµÄserver.urlencodeÈ´²úÉú²»Á˺ÍHttpUtility.UrlEncodeÒ»ÑùµÄ±àÂ룬ÇëÎÊÓÐûÓнâ¾ö°ì·¨
²¹³ä£ºÔÀ´asp.netµÄÊÇ"web.aspx?str="+HttpUtility.UrlEncode(str)
ºÍHttpUtility.UrlDecode(Requ ......
ÕâÊÇҪʵÏֵŦÄÜ£º
µÚÒ»²½£ºÍÏÈëGridView¿Ø¼þ ²¢ÇÒÍê³É²éѯËùÓÐÊý¾ÝµÄ·½·¨ ͨ¹ýthis.GridView1.DataSource »ñÈ¡¼¯ºÏÊý¾Ý GridView1.DataBind() °ó¶¨Êý¾Ý
µÚ¶þ²½£ºÊµÏÖÈ«Ñ¡¹¦ÄÜ
1. Ò³Ãæ´úÂ룺
´úÂë
<asp:TemplateField HeaderText="È«Ñ¡">
&nbs ......