Tag Archive: ASP.NET

IIS属性没有ASP.NET选项

1,如果是只安装了.net framework 1.1 在iis中是不显示那个选项卡的。默认就会支持asp.net1.1。在安装了.net framework 2.0后,iis站点属性里才会有asp.net的选项。

2,安装asp.net2.0后,请关闭iis窗口,重新打开iis,iis站点属性里才会有asp.net的选项

3,如果还没有,那么就要重新在IIS中注册asp.net,方法如下:
(1) 打开命令窗口。(依次单击“开始”、“运行”,键入 cmd,然后单击“确定”。)
(2) 浏览到要使用的 Aspnet_regiis.exe 版本的目录(请记住,每个版本的 .NET Framework 都有自己的 Aspnet_regiis.exe 版本)。该文件通常位于下列目录中: systemroot\Microsoft.NET\Framework\versionNumber
输入以下代码,回车,等待其安装完成 。
如:C:\Windows\\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis -i
如:C:\Windows\\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i

解决:
1:在服务中停止IIS Admin Service(同时会提示是否停止对应的其他,将这些服务都停止)
2:打开文件” C:\WINDOWS\system32\inetsrv\MetaBase.xml”,
删除Enable32BitAppOnWin64=’TRUE’这句话后保存文件。3:重新启动IIS Admin Service服务和IIS后就可以看到ASP.net Tab

Category: 技术 TAG: , , ,

一定要记下来,新的DataGrid输出excel的代码

Response.Clear();
Response.Buffer = true;
Response.Charset = “GB2312″;
Response.AppendHeader(“Content-Disposition”, “attachment;filename=all.xls”);
Response.ContentEncoding = System.Text.Encoding.GetEncoding(“GB2312″);
Response.ContentType = “application/ms-excel”;
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo(“zh-cn”, true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.DataGrid2.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
Category: 技术 TAG: , , ,

.net c# 读取xml

test.xml

<?xml version= ’1.0′ encoding=’utf-8′?>
<Employees>
<NO1>
<Name> Ma   Jin   Hu </Name>
<ZIP>   239000   </ZIP>
<Address> Feng   Huang   Street </Address>
<City> Chu   Zhou   City </City>
<State>   ANHUI   </State>
</NO1>
<NO2>
<Name> Wang   Tian </Name>
<ZIP>   239000   </ZIP>
<Address> Lang   Ya   Street </Address>
<City> He   Fei   City </City>
<State>   ANHUI   </State>
</NO2>
<NO3>
<Name> Zou   Wen   Biao </Name>
<ZIP>   100000   </ZIP>
<Address> Sai   Di   Street </Address>
<City> Bei   Jin   City </City>
<State> Bei   Jin </State>
</NO3>
</Employees>

<?xml version= ’1.0′ encoding=’utf-8′?><Employees>  <NO1>    <Name> Ma   Jin   Hu </Name>    <ZIP>   239000   </ZIP>    <Address> Feng   Huang   Street </Address>    <City> Chu   Zhou   City </City>    <State>   ANHUI   </State>  </NO1>  <NO2>    <Name> Wang   Tian </Name>    <ZIP>   239000   </ZIP>    <Address> Lang   Ya   Street </Address>    <City> He   Fei   City </City>    <State>   ANHUI   </State>  </NO2>  <NO3>    <Name> Zou   Wen   Biao </Name>    <ZIP>   100000   </ZIP>    <Address> Sai   Di   Street </Address>    <City> Bei   Jin   City </City>    <State> Bei   Jin </State>  </NO3></Employees>

cs文件

protected void Page_Load(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath(“test.xml”));
XmlElement root = doc.DocumentElement;
Response.Write(root.SelectSingleNode(“NO1/Name”).InnerText);
}

Category: 技术 TAG: , , ,

C#(ASP.NET)公历转农历的简单方法

Kangka | 2010年07月9日 | COMMENTS:Comments Closed

/// <summary>
/// 公历转为农历的函数
/// </summary>
/// <remarks>作者:kangka</remarks>
/// <example>网址:http://www.kangka.net</example>
/// <param name="solarDateTime">公历日期</param>
/// <returns>农历的日期</returns>
static string SolarToChineseLunisolarDate(DateTime solarDateTime)
{
    System.Globalization.ChineseLunisolarCalendar cal = new System.Globalization.ChineseLunisolarCalendar();

    int year = cal.GetYear(solarDateTime);
    int month = cal.GetMonth(solarDateTime);
    int day = cal.GetDayOfMonth(solarDateTime);
    int leapMonth = cal.GetLeapMonth(year);
    return string.Format("农历{0}{1}({2})年{3}{4}月{5}{6}"
                        , "甲乙丙丁戊己庚辛壬癸"[(year - 4) % 10]
                        , "子丑寅卯辰巳午未申酉戌亥"[(year - 4) % 12]
                        , "鼠牛虎兔龙蛇马羊猴鸡狗猪"[(year - 4) % 12]
                        , month == leapMonth ? "闰" : ""
                        , "无正二三四五六七八九十冬腊"[leapMonth > 0 && leapMonth <= month ? month - 1 : month]
                        , "初十廿三"[day / 10]
                        , "日一二三四五六七八九"[day % 10]
                        );
}
Category: 网海拾贝 TAG: , , ,

asp.net 每天定点执行任务

下面是每天零点执行一个存储过程

 

 

代码如下:
public static void ClearCountByTime()
{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(TimeEvent);
// 设置引发时间的时间间隔 此处设置为1秒
aTimer.Interval = 1000;
aTimer.Enabled = true;
}
private static void TimeEvent(object source, ElapsedEventArgs e)
{
// 得到 hour minute second 如果等于某个值就开始执行
int intHour = e.SignalTime.Hour;
int intMinute = e.SignalTime.Minute;
int intSecond = e.SignalTime.Second;
// 定制时间,在00:00:00 的时候执行
int iHour = 00;
int iMinute = 00;
int iSecond = 00;
// 设置 每天的00:00:00开始执行程序
if (intHour == iHour && intMinute == iMinute && intSecond == iSecond)
{
ClearCount();
}
}
public static void ClearCount()
{
string sql = "要执行的存储过程";
int result=SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, sql);
if (result > 0)
{
//TodayCount清零成功!;
}
else
{
//TodayCount清零失败!;
}
}

Category: 技术 TAG: , , , , , ,

C#关于DateTime得到的当前时间的格式

 

DateTime.Now.ToShortTimeString()
DateTime dt = DateTime.Now;
dt.ToString();//2005-11-5 13:21:25
dt.ToFileTime().ToString();//127756416859912816
dt.ToFileTimeUtc().ToString();//127756704859912816
dt.ToLocalTime().ToString();//2005-11-5 21:21:25
dt.ToLongDateString().ToString();//2005年11月5日
dt.ToLongTimeString().ToString();//13:21:25
dt.ToOADate().ToString();//38661.5565508218
dt.ToShortDateString().ToString();//2005-11-5
dt.ToShortTimeString().ToString();//13:21
dt.ToUniversalTime().ToString();//2005-11-5 5:21:25
dt.Year.ToString();//2005
dt.Date.ToString();//2005-11-5 0:00:00
dt.DayOfWeek.ToString();//Saturday
dt.DayOfYear.ToString();//309
dt.Hour.ToString();//13
dt.Millisecond.ToString();//441
dt.Minute.ToString();//30
dt.Month.ToString();//11
dt.Second.ToString();//28
dt.Ticks.ToString();//632667942284412864
dt.TimeOfDay.ToString();//13:30:28.4412864
dt.ToString();//2005-11-5 13:47:04
dt.AddYears(1).ToString();//2006-11-5 13:47:04
dt.AddDays(1.1).ToString();//2005-11-6 16:11:04
dt.AddHours(1.1).ToString();//2005-11-5 14:53:04
dt.AddMilliseconds(1.1).ToString();//2005-11-5 13:47:04
dt.AddMonths(1).ToString();//2005-12-5 13:47:04
dt.AddSeconds(1.1).ToString();//2005-11-5 13:47:05
dt.AddMinutes(1.1).ToString();//2005-11-5 13:48:10
dt.AddTicks(1000).ToString();//2005-11-5 13:47:04
dt.CompareTo(dt).ToString();//0
dt.Add(?).ToString();//问号为一个时间段
dt.Equals("2005-11-6 16:11:04").ToString();//False
dt.Equals(dt).ToString();//True
dt.GetHashCode().ToString();//1474088234
dt.GetType().ToString();//System.DateTime
dt.GetTypeCode().ToString();//DateTime
dt.GetDateTimeFormats('s')[0].ToString();//2005-11-05T14:06:25
dt.GetDateTimeFormats('t')[0].ToString();//14:06
dt.GetDateTimeFormats('y')[0].ToString();//2005年11月
dt.GetDateTimeFormats('D')[0].ToString();//2005年11月5日
dt.GetDateTimeFormats('D')[1].ToString();//2005 11 05
dt.GetDateTimeFormats('D')[2].ToString();//星期六 2005 11 05
dt.GetDateTimeFormats('D')[3].ToString();//星期六 2005年11月5日
dt.GetDateTimeFormats('M')[0].ToString();//11月5日
dt.GetDateTimeFormats('f')[0].ToString();//2005年11月5日 14:06
dt.GetDateTimeFormats('g')[0].ToString();//2005-11-5 14:06
dt.GetDateTimeFormats('r')[0].ToString();//Sat, 05 Nov 2005 14:06:25 GMT
string.Format("{0:d}",dt);//2005-11-5
string.Format("{0:D}",dt);//2005年11月5日
string.Format("{0:f}",dt);//2005年11月5日 14:23
string.Format("{0:F}",dt);//2005年11月5日 14:23:23
string.Format("{0:g}",dt);//2005-11-5 14:23
string.Format("{0:G}",dt);//2005-11-5 14:23:23
string.Format("{0:M}",dt);//11月5日
string.Format("{0:R}",dt);//Sat, 05 Nov 2005 14:23:23 GMT
string.Format("{0:s}",dt);//2005-11-05T14:23:23
string.Format("{0:t}",dt);//14:23
string.Format("{0:T}",dt);//14:23:23
string.Format("{0:u}",dt);//2005-11-05 14:23:23Z
string.Format("{0:U}",dt);//2005年11月5日 6:23:23
string.Format("{0:Y}",dt);//2005年11月
string.Format("{0}",dt);//2005-11-5 14:23:23
string.Format("{0:yyyyMMddHHmmssffff}",dt);
//计算2个日期之间的天数差
//-----------------------------------------------
DateTime dt1 = Convert.DateTime("2007-8-1");
DateTime dt2 = Convert.DateTime("2007-8-15");
TimeSpan span = dt2.Subtract(dt1);
int dayDiff = span.Days + 1;
//计算某年某月的天数
-----------------------------------------------
int days = DateTime.DaysInMonth(2007, 8);
days = 31;
//给日期增加一天、减少一天
-----------------------------------------------
DateTime dt =DateTime.Now;
dt.AddDays(1); //增加一天
dt.AddDays(-1);//减少一天
//其它年份方法类似...
Oracle SQL里转换日期函数
-----------------------------------------------
to_date("2007-6-6",'YYYY-MM-DD");
to_date("2007/6/6",'yyyy/mm/dd");
如下一组数据,如何查找表里包含9月份的记录:
CGGC_STRATDATE  CGGC_ENDDATE
=========================================
2007-8-4  2007-9-5
2007-9-5  2007-9-20
2007-9-22  2007-10-5
SELECT * FROM TABLE
(TO_DATE('2007/9/1','yyyy/mm/dd') BETWEEN CGGC_STRATDATE
AND CGGC_ENDDATE OR CGGC_STRATDATE >=TO_DATE('2007/9/1','yyyy/mm/dd')
AND CGGC_ENDDATE<=TO_DATE('2007/9/30','yyyy/mm/dd') "
OR TO_DATE('2007/9/30','yyyy/mm/dd') BETWEEN CGGC_STRATDATE
AND CGGC_ENDDATE) ORDER BY CGGC_STRATDATE ASC
Category: 技术 TAG: , , , , , , ,

C# WebBrowser 抓图获取网页验证码

在.NET的WINFORM开发中,大家可能都比较熟悉了WINFORM控件的 DrawToBitmap 方法。但是,如果你使用 WebBrowser 的时候,却发现没有 DrawToBitmap 这个功能,然而,WebBrowser 实际上是有这个功能的, 只是在VS IDE的智能提示列表里面没有显示。

WHY ? 俺也不知道

 

网页中的验证码,其实是通过一个独立的页面来输出的,例如 CSDN 的登录验证码地址为: http://passport.csdn.net/ShowExPwd.aspx

我们下面用WebBrowser获取这个图片,显示在窗体的PictureBox上。

 

this.webBrowser1.Navigate("http://passport.csdn.net/ShowExPwd.aspx");
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Bitmap bmp = new Bitmap(200, 200);
webBrowser1.DrawToBitmap(bmp, new Rectangle(0, 0, 300, 300));
this.pictureBox1.Image = bmp;
}

 

需要说明的一点:

如果WebBrowser是动态创建的,则必须可见,否则,抓图是全白,没有内容的。

Category: 技术 TAG: , , , , , , , , ,

Asp.Net中的事件和委托的实现

页面:

<%@ Page Language="C#" CodeBehind="Default.aspx.cs" AutoEventWireup="true" Inherits="WebApplication1._Default" %>

 后台:
 

protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page is loaded by Page_Load!<br>");
}
protected override void OnLoad(EventArgs e)
{
Response.Write("Page is loaded by OnLoad!<br>");
base.OnLoad(e);
}

问题:
 

1.  如果 AutoEventWireup="false",输出会是什么?

2.  如果注释掉 base.OnLoad(e); 输出会是什么?

3.  关于其他 AutoEventWireup 设置和 base.OnLoad(e)注释与否的组合,结果各是什么?

 这里首先给初学者介绍一个vs2008中的一个快捷键:F12;然后推荐一个工具:reflactor。很多时候,工具的使用比掌握某一个知识点更有用,所谓”授人以鱼,不如授人以渔“。F12可以转到方法的定义,reflactor则可以“反编译”.net程序集,是我们学习.net的利器啊,呵呵。

首先,如果 AutoEventWireup="false",我们会发现Page_Load方法根本不会执行(可设置断点查看)。如果你是直接学的asp.net2.0,很有可能你会忽视这个知识点(很不幸,我也是直接学的2.0)。AutoEventWireup是ASP.NET2.0一个新增的属性(具体可以查MSDN),它用于实现ASP.NET2.O页面事件的自动绑定!
我们回过头来想一想委托和事件吧! 我们常常说,页面事件,页面生命周期……,这些东西究竟是怎么被实现的呢?我们能够看到他们实现的代码么?
可以想象,Page_Load方法如果需要执行,必然应该和页面事件相关联。在Page这个类中,一定会暴露一个事件(如Onload);然后,我们还需要“订 ridge; border-top: #cccccc thin ridge; border-left: #cccccc thin ridge; border-bottom: #cccccc thin ridge; background-color: #f0f0f0″ name=”CodeLight_code”>
// Summary:
// Occurs when page initialization is complete.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler InitComplete;
//
// Summary:
// Occurs at the end of the load stage of the page’s life cycle.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler LoadComplete;
//
// Summary:
// Occurs at the beginning of page initialization.
public event EventHandler PreInit;
//
// Summary:
// Occurs before the page System.Web.UI.Control.Load event.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler PreLoad;
//
// Summary:
// Occurs before the page content is rendered.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler PreRenderComplete;
//
// Summary:
// Occurs after the page has completed saving all view state and control state
// information for the page and controls on the page.
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event EventHandler SaveStateComplete;

哇塞,都是事件哟!但很可惜,我们没能找到想要的OnLoad事件……

好在我们还有这行代码:

base.OnLoad(e);

将鼠标点到OnLoad(e)上,再F12,哈哈,找到了:

 

base.OnLoad(e);

将鼠标点到OnLoad(e)上,再F12,哈哈,找到了:

 

//
// Summary:
//     Raises the System.Web.UI.Control.Load event.
//
// Parameters:
//   e:
//     The System.EventArgs object that contains the event data.
protected internal virtual void OnLoad(EventArgs e);

不容易啊,仔细一看,居然在Control类里,原来Page继承的是Control类,和我们一般的想法有点相反哟!(这里就不再展开了)更加注释,我们可以看出,这个方法就是raise(击发) Load事件的方法了!在这个Control类里,我们也能看到Load事件的声明:
 

//
// Summary:
//     Occurs when the server control is loaded into the System.Web.UI.Page object.
[WebSysDescription("Control_OnLoad")]
public event EventHandler Load;

还可以看到事件绑定的委托EventHandler,再F12,我们能看到EventHandler的声明:

 

// Summary:
//     Represents the method that will handle an event that has no event data.
//
// Parameters:
//   sender:
//     The source of the event.
//
//   e:
//     An System.EventArgs that contains no event data.
[Serializable]
[ComVisible(true)]
public delegate void EventHandler(object sender, EventArgs e);

看到代码的感觉真爽,很踏实!是不是?更精彩的还在reflactor,

 

protected internal virtual void OnLoad(EventArgs e)
{
if (this.HasEvents())
{
EventHandler handler = this._occasionalFields.Events[EventLoad] as EventHandler;
if (handler != null)
{
handler(this, e);
}
}
}

和我们的想象有一点差别,但完全可以理解,而且你可以进一步的点击深入。
 

 

至此,我们可以梳理出ASP.NET的委托事件机制:
1.  .NET自有的委托EventHandler,确定了委托调用的方法签名(参数:sender和e,返回值void),这就是为什么我们看到的事件方法都长得一个样子的原因;

2.  在Page类及其父类中,的确是定义了一系列的事件和击发(raise)这些事件的方法。我们可以利用这些事件(如写Page_Load()方法),也可以直接override调用这些事件的方法(如OnLoad()方法)。这两者之间的区别或关系,以前我一直是晕的。

3.  因为AutoEventWireup的原因,我们没有看到“事件订阅”的代码,太遗憾了,所以我们接下来自己实现它:(首先AutoEventWireup=“false”)

 

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Load += new EventHandler(Page_Load);
}
Category: 技术 TAG: , , , ,

.net中用jQuery实现提示功能和表单验证功能(附源码)

 

1. 即时表单验证和提示

 2. 提交表单时验证

  

下面看下我们如何在 asp.net 中实现便捷的提示功能和表单验证功能
HTML代码如下:

<li> 
    <label>航班号</label> 
    <asp:TextBox ID="_flightno" runat="server" reg="\w{2}\d{4}" tip="设置航班号(大写)" toupper="true" /> 
</li> 
<li> 
    <label>航司(2字代码)</label> 
    <asp:TextBox ID="_airline" runat="server" reg="\w{2}" toupper="true" /> (注意大写) 
</li> 
<li> 
    <label>起飞时间</label> 
    <asp:TextBox ID="_beingtime" runat="server" reg="\d{4}" tip="设置起飞时间 格式: hhmm" /> (格式: hhmm) 
</li>

以上的实现是不是很方便, 不用写大堆的 javascript 逻辑代码便可轻松实现验证和提示功能

 通过调用 $(document).ready(function() {jQuery(‘input[tip],input[reg]‘).tooltip({onsubmit: true})}); 便完成数据的验证和提示功能. (该调用已集成在tooltip.js中)

onsubmit: true 这里设置是否触发 onsubmit 的提交验证事件.再看看 CSS 的实现

 
.tooltipinputerr 
{}{ 
     padding
: 2px 0 2px 18px; 
     border
: solid 1px red; 
     background
: #ffff99 url(/images/exclamation.png) no-repeat 2px center
    } 
     
.tooltipinputok 
{}{ 
     padding
: 2px 0 2px 18px; 
     border
: solid 1px green; 
     background
: url(/images/accept.png) no-repeat 2px center
    } 
     
.tooltipshowpanel 
{}{ 
     z-index
: auto; 
     display
: none; 
     position
:absolute; 
     width
: 276px; 

     height
: 35px; 
     overflow
: hidden; 
     text-indent
: 5px; 
     line-height
: 40px; 
     font-size
: 12px; 
     font-family
: Arial; 
     background
: url(/images/tooltop.gif) no-repeat left top; 
     opacity
:0.9; 
     filter
: alpha(opacity=90)
    }

使用方法:

一.

Download jQuery
Download jQuery 1.2.6 (16kb, Minified and Gzipped) Great for production use.

Download jQuery 1.2.6 (97kb, Uncompressed) Great for testing, learning and development.

Download jQuery 1.2.6 (30kb, Packed) For those that can’t Gzip their JavaScript.

二. 加入以上样式和引用tooltip.js文件
Tooltip.pack.js  
Tooltip.mini.js
Tooltip.js  

下载以上三个文件

 

 

完整源码下载:

200912101525127537.rar

Category: 技术 TAG: , , , , , , , , , , ,

C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作()

 应用程序配置文件,对于asp.net是 web.config,对于WINFORM程序是 App.Config(ExeName.exe.config)。

配置文件,对于程序本身来说,就是基础和依据,其本质是一个xml文件,对于配置文件的操作,从.NET 2.0 开始,就非常方便了,提供了 System [.Web] .Configuration 这个管理功能的NameSpace,要使用它,需要添加对 System.configuration.dll的引用。

对于WINFORM程序,使用 System.Configuration.ConfigurationManager;

对于ASP.NET 程序, 使用 System.Web.Configuration.WebConfigurationManager;

对于配置文件内容的读取,真是太普遍不过了,如果你的程序里,没有读取配置文件内容的方面,你都不好意思拿出来用 

我们以最常见的 AppSettings 小节来作为例子:

假设有如下的配置文件内容:

<?xml version="1.0" encoding="utf-8" ?><configuration>  <appSettings>    <add key="y" value="this is Y"/>  </appSettings></configuration>

1. 读取值:

  • Asp.Net:   System.Web.Configuration.WebConfigurationManager.AppSettings[“y”];
  • WinForm:  System.Configuration.ConfigurationManager.AppSettings[“y”];

2. 添加一项

  • ASP.NET(需要有写权限):
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);AppSettingsSection app = config.AppSettings;app.Settings.Add("x", "this is X");config.Save(ConfigurationSaveMode.Modified);
  • WinForm:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);AppSettingsSection app = config.AppSettings;app.Settings.Add("x", "this is X");config.Save(ConfigurationSaveMode.Modified);

 

3. 修改一项

  • Asp.Net
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);AppSettingsSection app = config.AppSettings;//app.Settings.Add("x", "this is X"); app.Settings["x"].Value = "this is not Y";config.Save(ConfigurationSaveMode.Modified);
  • WinForm
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);AppSettingsSection app = config.AppSettings;//app.Settings.Add("x", "this is X"); app.Settings["x"].Value = "this is not Y";config.Save(ConfigurationSaveMode.Modified);

 

4. 删除一项

  • Asp.Net
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);AppSettingsSection app = config.AppSettings;app.Settings.Remove("x");config.Save(ConfigurationSaveMode.Modified);
  • WinForm
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);AppSettingsSection app = config.AppSettings;app.Settings.Remove("x")
;config.Save(ConfigurationSaveMode.Modified);
 

 

Category: 技术 TAG: , , , , , , , , , , ,