ASP.NET²Ù×÷web.config
ASP.NET¿ÉÒÔÀûÓÃWebConfigurationManagerºÍÖ±½ÓÀûÓÃXML·½Ê½²Ù×÷web.config,WebConfigurationManager±È½Ï¼òµ¥£¬µ«ÊÇÇå³ý×¢ÊÍ´úÂë¡£Á½Õß²Ù×÷·½Ê½¶¼ÐèÒªÓÐдȨÏÞ¡£
·½·¨Ò»£¬ÀûÓÃWebConfigurationManager£¬ÐèÒªÒýÓÃSystem.Web.Configuration.WebConfigurationManager£»
Ìí¼ÓÏ
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
app.Settings.Add("key", "valueadd");
config.Save(ConfigurationSaveMode.Modified);
ÐÞ¸ÄÏ
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
app.Settings["key"].Value = "valuemodify";
config.Save(ConfigurationSaveMode.Modified);
ɾ³ýÏ
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
app.Settings.Remove("key");
config.Save(ConfigurationSaveMode.Modified);
ÐÞ¸ÄÁ¬½ÓÏ
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConnectionStringsSection conSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
conSection.ConnectionStrings[Request["type"].ToString()].ConnectionString = Request["connstr"];
config.Save(ConfigurationSaveMode.Modified);
XmlDocument xmldoc = new XmlDocument();
string filename = Common.FilePath("../web.config");
&nbs
Ïà¹ØÎĵµ£º
ʹÓÃasp.net ¿ª·¢wap ÍøÕ¾£¬ÔÚishtml32Ï£¬Èç¹ûÊÖ»úä¯ÀÀÆ÷Ö§³Öishtml32,µ«ÊÇ SupportsCss=False ʱ£¬Ïë¼ÓÔØcssÎļþʱ£¬²ÉÓÃÖØÐ´mobile:formµÄ·½·¨À´ÊµÏÖ
using System;
using System.Configuration;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
public class MyForm : Form
{ ......
ÔÚÍøÉÏËѼ¯ÕûÀíµÄ×ÊÁÏ£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú
1.<%=...%>Óë<%#... %>µÄÇø±ð:
´ð:<%=...%>ÊÇÔÚ³ÌÐòÖ´ÐÐʱµ÷ÓÃ,<%#... %>ÊÇÔÚDataBind()·½·¨Ö®ºó±»µ÷ÓÃ
2.¿Ø¼þ½ÓÊÕÄÄЩÀàÐÍÊý¾Ý?
´ð:½ÓÊÕBindµÄ¿Ø¼þ,Ò»°ãÓÐdropDownList,DataList,DataGrid,ListBoxÕâЩ¼¯ºÏÐÔÖʵĿؼþ,¶ø±»À¦°ó ......
web.config¹ØÓÚsessionState½ÚµãµÄÅäÖ÷½°¸£¬sessionStateÓÐËÄÖÖģʽ£ºoff,inProc,StateServer,SqlServer¡£
1¡¢offģʽ
´Ó×ÖÃæÉϾͿÉÒÔ¿´³öÕâ¸öÊǹرÕģʽ£¬Èç¹ûµ±Ç°Ò³Ãæ²»ÐèÒªsessionµÄÖµ£¬ÎªÁ˼õÉÙ·þÎñÆ÷×ÊÔ´£¬Äã¿ÉÒÔÈ¥µôSessionµÄ¿ªÏú¡£
<sessionState mode="off">»òÕßÒ³ÃæÉÏ
<%@ Page EnableSessionState= ......
@PageÖ¸ÁîλÓÚÿ¸öASP.NETÒ³ÃæµÄ¶¥²¿£¬¸æËßASP.NETÕâ¸ö¾ßÌåÒ³ÃæÊ¹ÓÃʲôÊôÐÔ£¬ÒÔ¼°¸ÃÒ³Ãæ¼Ì³ÐµÄÓû§¿Ø¼þ¡£ASP.NETÒ³Ãæ
@PageÖ¸ÁîÊôÐÔÓУºAspCompat¡¢Async¡¢AsyncTimeout¡¢AutoEventWireup¡¢Buffer¡¢
ClassName¡¢ClientIDMode¡¢CodeBehind¡¢
CodeFile¡¢CodeFileBaseClass¡¢CodePage¡¢CompilationMode ¡¢ContentType¡¢
......
Äú¿ÉÒÔͨ¹ýÒÔÏÂÉèÖÿØÖÆasp.net¶Ô·þÎñÆ÷ÄÚ´æµÄÕ¼Óᣲ¢ÄÜÉèÖÃaspnet½ø³Ì¶¨Ê±Öؽ¨£¨ÀàËÆIIS6ÖÐAppPoolÀïµÄ¶¨Ê±ÖØÆô£©£¬ÕâÑù¿ÉÒÔ±ÜÃâ·þÎñÆ÷³¤Ê±¼äÔËÐÐaspnetÕ¼ÓôóÁ¿¿ÕÏÐÄڴ棬ÓÐÀûÓÚÌá¸ßaspnetÔËÐÐЧÂÊ¡£
aspnetÅäÖÃÎļþλÖÃΪ
CWINDOWSMicrosoft.NETFrameworkv1.1.4322CONFIGmachine.config
ÓÃÎı¾±à¼Æ÷´ò¿ª¸ÃÎļþ£¬ÕÒµ ......