爱编程 - .NET
type: channel
link: https://masoft.cn/tag/NET
items: .NET Model验证及常用正则表达式
items: C#调用WPS转换Word、Excel、PPT文件为PDF
items: Entity Framework的实体关系
items: UEdit在ASP.NET MVC中上传的控制器
items: .NET支付类库及其使用
items: .NET网站请求过滤验证防恶意字符
items: .NET使用阿里云云存储上传文件
items: .NET线程操作类使用说明
items: .NET中System.Web.Caching.Cache缓存
items: ASP.NET网站开发中Web.config文件节点

.NET Model验证及常用正则表达式
type: item
date: 2020-01-06T10:38:00+08:00
description: 1、必须填写[Required(ErrorMessage = "纸张名称不能为空")] public string Name { get; set; }2、长度限制//至多n位： [StringLength(50, ErrorMessage = "最多50个字符")] public string Name { get; set; } //要求至少n位： [StringLength(50, MinimumLength=10, ErrorMessage = "10~50个字符")] public string Name { get; set; }3、正则验证[RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", ErrorMessage = "格式错误")] public string Email { get; set; }4、数字范围//整数 [Range(1,120, ErrorMessage = "范围1~120")] public int Age { get; set; } //小数 [Range(typeof(decimal), "0.00", "49.99", ErrorMessage = "范围0~49.99")] public decimal Price { get; set; }5、比较验证//新密码 public string NewPassword{ get; set; } //确认密码 [Compare("NewPassword",ErrorMessage = "确认密码与新密码不一致")] public string ConfirmPassword{ get; set; }7、常用正则表达式数字："^[0-9]*$"。 n位的数字："^\d{n}$"。 至少n位的数字："^\d{n,}$"。 m~n位的数字：。"^\d{m,n}$" 零和非零开头的数字："^(0|[1-9][0-9]*)$"。 有两位小数的正实数："^[0-9]+(.[0-9]{2})?$"。 有1~3位小数的正实数："^[0-9]+(.[0-9]{1,3})?$"。 非零的正整数："^\+?[1-9][0-9]*$"。 非零的负整数："^\-[1-9][]0-9"*$。 长度为3的字符："^.{3}$"。 由26个英文字母组成的字符串："^[A-Za-z]+$"。 由26个大写英文字母组成的字符串："^[A-Z]+$"。 由26个小写英文字母组成的字符串："^[a-z]+$"。 由数字和26个英文字母组成的字符串："^[A-Za-z0-9]+$"。 由数字、26个英文字母或者下划线组成的字符串："^\w+$"。 验证用户密码："^[a-zA-Z]\w{5,17}$"正确格式为：以字母开头，长度在6~18之间，只能包含字符、数字和下划线。 验证是否含有^%&’,;=?$\"等字符："[^%&’,;=?$\x22]+"。 只能输入汉字："^[\u4e00-\u9fa5]{0,}$" 验证Email地址："^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"。 验证InternetURL："^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$"。 验证电话号码："^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$"正确格式为："XXX-XXXXXXX"、"XXXX- XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"。 验证身份证号(15位或18位数字)："^\d{15}|\d{18}$"。 验证一年的12个月："^(0?[1-9]|1[0-2])$"正确格式为："01"～"09"和"1"～"12"。 验证一个月的31天："^((0?[1-9])|((1|2)[0-9])|30|31)$"正确格式为;"01"～"09"和"1"～"31"。

C#调用WPS转换Word、Excel、PPT文件为PDF
type: item
date: 2019-06-11T15:56:00+08:00
description: C#调用WPS转换Word、Excel、PPT文件为PDF，耗时稍微长一点，但是文件转换格式不存在问题。需要安装WPSusing System; using Excel; using PowerPoint; using Word; namespace SharePint.Code { public class FileTransform { /// /// Word转PDF /// /// word文件地址 /// 保存PDF地址 /// <returns></returns> public static bool WordToPdf(string pWordFile, string pSavePdf) { var type = Type.GetTypeFromProgID("KWps.Application"); dynamic wps = Activator.CreateInstance(type); try { var doc = wps.Documents.Open(pWordFile, Visible: false); doc.ExportAsFixedFormat(pSavePdf, WdExportFormat.wdExportFormatPDF); doc.Close(); } catch (Exception e) { return false; } finally { wps.Quit(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } return true; } /// /// Excel转PDF /// /// Excel文件地址 /// 保存PDF地址 /// <returns></returns> public static bool ExcelToPdf(string pExcelFile, string pSavePdf) { var type = Type.GetTypeFromProgID("KET.Application"); dynamic wps = Activator.CreateInstance(type); try { var targetType = XlFixedFormatType.xlTypePDF; var missing = Type.Missing; var doc = wps.Application.Workbooks.Open(pExcelFile, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); doc.ExportAsFixedFormat(targetType, pSavePdf, XlFixedFormatQuality.xlQualityStandard, true, false, missing, missing, missing, missing); doc.Close(); } catch (Exception e) { return false; } finally { wps.Quit(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } return true; } /// /// PPT转PDF /// /// PPT文件地址 /// 保存PDF地址 /// <returns></returns> public static bool PptToPdf(string pPptFile, string pSavePdf) { var type = Type.GetTypeFromProgID("KWPP.Application"); dynamic wps = Activator.CreateInstance(type); try { var doc = wps.Presentations.Open(pPptFile, MsoTriState.msoCTrue, MsoTriState.msoCTrue, MsoTriState.msoCTrue); doc.SaveAs(pSavePdf, PpSaveAsFileType.ppSaveAsPDF, MsoTriState.msoTrue); doc.Close(); } catch (Exception e) { …

Entity Framework的实体关系
type: item
date: 2018-12-18T15:35:00+08:00
description: 刚开始使用 Entity Framework 的时候，由于没有静下心来认真理清关系，走了一些"痛不欲生"的弯路。而我们目前开发的项目都在使用 Entity Framework，为了避免其他人再经历"痛不欲生"的弯路。于是下定决心边“理清关系”边“写博客”。而写博客可以逼着自己把问题完整地解决，避免半途而废。当写出这些文章，自己不知不觉对问题有了更深的理解。1. 一对一关系（one-to-one）a) 单向一对一类图：数据库表结构：Entity Framework中实体关系的定义：modelBuilder.Entity<BlogSite>() .HasRequired(b => b.BlogUser) .WithMany() .HasForeignKey(b => b.UserID);b) 双向一对一类图：数据库表结构：Entity Framework中实体关系的定义：modelBuilder.Entity<BlogSite>() .HasRequired(b => b.BlogUser) .WithMany() .HasForeignKey(b => b.UserID); modelBuilder.Entity<BlogUser>() .HasRequired(u => u.BlogSite) .WithMany() .HasForeignKey(u => u.BlogID);2. 一对多关系（one-to-many）类图：数据库表结构：Entity Framework中实体关系的定义：modelBuilder.Entity<BlogSite>() .HasMany(b => b.BlogPosts) .WithRequired(p => p.BlogSite);3. 多对多关系（many-to-many）类图：数据库表结构：Entity Framework中实体关系的定义：modelBuilder.Entity<BlogSite>() .HasMany(b => b.Categories) .WithMany(c => c.BlogPosts) .Map ( m => { m.MapLeftKey("BlogPostID"); m.MapRightKey("CategoryID"); m.ToTable("BlogPost_Category"); } );

UEdit在ASP.NET MVC中上传的控制器
type: item
date: 2018-11-11T21:23:00+08:00
description: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Ell.Web.Code.Edit; using Newtonsoft.Json; namespace Ell.Web.Controllers { public class EditController : Controller { public void Index() { HttpContext context = System.Web.HttpContext.Current; Handler action = null; switch ( context.Request["action"] ) { case "config": action = new ConfigHandler( context ); break; case "uploadimage": action = new UploadHandler( context, new UploadConfig() { AllowExtensions = Config.GetStringList( "imageAllowFiles" ), PathFormat = Config.GetString( "imagePathFormat" ), SizeLimit = Config.Getint( "imageMaxSize" ), UploadFieldName = Config.GetString( "imageFieldName" ) } ); break; case "uploadscrawl": action = new UploadHandler( context, new UploadConfig() { AllowExtensions = new string[] { ".png" }, PathFormat = Config.GetString( "scrawlPathFormat" ), SizeLimit = Config.Getint( "scrawlMaxSize" ), UploadFieldName = Config.GetString( "scrawlFieldName" ), Base64 = true, Base64Filename = "scrawl.png" } ); break; case "uploadvideo": action = new UploadHandler( context, new UploadConfig() { AllowExtensions = Config.GetStringList( "videoAllowFiles" ), PathFormat = Config.GetString( "videoPathFormat" ), SizeLimit = Config.Getint( "videoMaxSize" ), UploadFieldName = Config.GetString( "videoFieldName" ) } ); break; case "uploadfile": action = new UploadHandler( context, new UploadConfig() { AllowExtensions = Config.GetStringList( "fileAllowFiles" ), PathFormat = Config.GetString( "filePathFormat" ), SizeLimit = Config.Getint( "fileMaxSize" ), UploadFieldName = Config.GetString( "fileFieldName" ) } ); break; case "listimage": action = new ListFileManager( context, Config.GetString( "imageManagerListPath" ), Config.GetStringList( "imageManagerAllowFiles" ) ); break; case "listfile": action = new ListFileManager( context, Config.GetString( "fileManagerListPath" ), Config.GetStringList( "fileManagerAllowFiles" ) ); break; case "catchimag…

.NET支付类库及其使用
type: item
date: 2018-11-11T19:21:00+08:00
description: 1、配置文件项目文件添加Config文件夹，文件中添加对应xml文件<?xml version="1.0" encoding="utf-8" ?> <Config> <Partner>合作身份者ID，以2088开头由16位纯数字组成的字符串</Partner> <Seller>收款支付宝账号（邮箱地址）</Seller> <Key>交易安全检验码，由数字和字母组成的32位字符串</Key> </Config><?xml version="1.0" encoding="utf-8" ?> <Config> <MerId>2222222222</MerId> <Version>222222222</Version> <Encoding>2222222222</Encoding> <SignMethod>oeeeeq3iez</SignMethod> <TxnType>eebq3iez</TxnType> <TxnSubType>oeee3kstubbq3iez</TxnSubType> <BizType>ood1jmeeeq3iez</BizType> <ChannelType>ood1eeez</ChannelType> <AccessType>ood1eeee3iez</AccessType> <CurrencyCode>ood1jmcnez</CurrencyCode> <SignCertpwd>ood1jmcnhjee</SignCertpwd> <FrontTransUrl>ood1eetubbq3iez</FrontTransUrl> <CertPath>ood1jmcnhjm2aeee3iez</CertPath> </Config><?xml version="1.0" encoding="utf-8" ?> <Config> <AppId>wx09a1334d45f1</AppId> <AppSecret>100000000000000000000000000</AppSecret> <MchId>12312311</MchId> <Key>kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk</Key> </Config><?xml version="1.0" encoding="utf-8" ?> <Config> <AppId>wx09a1334d45f1</AppId> <AppSecret>100000000000000000000000000</AppSecret> <MchId>12312311</MchId> <Key>kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk</Key> </Config>2、发起支付protected void Page_Load(object sender, EventArgs e) { ////////////////////////////////////////////请求参数//////////////////////////////////////////// //必填，不能修改 //服务器异步通知页面路径 string notify_url = "http://商户网关地址/create_direct_pay_by_user-CSHARP-UTF-8/notify_url.aspx"; //需http://格式的完整路径，不能加?id=123这类自定义参数 //页面跳转同步通知页面路径 string return_url = "http://商户网关地址/create_direct_pay_by_user-CSHARP-UTF-8/return_url.aspx"; //需http://格式的完整路径，不能加?id=123这类自定义参数，不能写成http://localhost/ //商户订单号 string out_trade_no = DateTime.Now.ToString("xxxxxx00001"); //商户网站订单系统中唯一订单号，必填 //订单名称 string subject = "订单名称"; //必填 //付款金额 string total_fee = "0.01"; //必填 //订单描述 string body = "订单描述"; //商品展示地址 string show_url = "http://www.bollshow.com"; //需以http://开头的完整路径，例如：http://www.商户网址.com/myorder.html //支付宝防钓鱼时间戳 //string anti_phishing_key = Genius.Payment.Alipay.Submit.Query_t…

.NET网站请求过滤验证防恶意字符
type: item
date: 2018-11-11T15:33:00+08:00
description: 1、Global.asax文件加入判断代码void Application_BeginRequest(object sender, EventArgs e) { string q = " 您的提交带有不合法参数,谢谢合作! 了解更多请点击:智汇科技 "; if (Request.Cookies != null) { if (WebSafe.CookieData()) { Response.Write("您提交的Cookie数据有恶意字符！"); Response.End(); } } if (Request.UrlReferrer != null) { if (WebSafe.referer()) { Response.Write("您提交的Referrer数据有恶意字符！"); Response.End(); } } if (Request.RequestType.ToUpper() == "POST") { if (WebSafe.PostData()) { Response.Write("您提交的Post数据有恶意字符！"); Response.End(); } } if (Request.RequestType.ToUpper() == "GET") { if (WebSafe.GetData()) { Response.Write("您提交的Get数据有恶意字符！"); Response.End(); } } }2、附请求过滤验证防恶意字符类库using System.Text.RegularExpressions; using System.Web; namespace Als.Utils.Net { public class WebSafe { /// /// 过滤字符 /// private const string StrRegex = @"^\+/v(8|9)|\b(and|or)\b.{1,6}?(=|>|<|\bin\b|\blike\b)|/\*.+?\*/|<\s*script\b|<\s*img\b|\bEXEC\b|UNION.+?SELECT|UPDATE.+?SET|INSERT\s+INTO.+?VALUES|(SELECT|DELETE).+?FROM|(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|DATABASE)"; /// /// POST请求验证 /// /// <returns></returns> public static bool PostData() { var result = false; for (var i = 0; i < HttpContext.Current.Request.Form.Count; i++) { result = CheckData(HttpContext.Current.Request.Form[i]); if (result) { break; } } return result; } /// /// GET请求验证 /// /// <returns></returns> public static bool GetData() { var result = false; for (var i = 0; i < HttpContext.Current.Request.QueryString.Count; i++) { result = CheckData(HttpContext.Current.Request.QueryString[i]); if (result) { break; } } return result; } /// /// 请求COOKIE验证 /// /// <returns></returns> public static bool CookieData() { var result = false; for (var i = 0; i < HttpContext.Current.Request.Cookies.Count; i++) { result = CheckData(HttpContext.Current.Request.Cookies[i]?.Value.ToLower()); if (result) { break; } } return result; } /// /// 请求Referer验证 /// /// <returns></returns> public static bool Referer() { return HttpContext.Current.Request.UrlReferrer != null && CheckData(HttpContext.…

.NET使用阿里云云存储上传文件
type: item
date: 2018-11-11T14:10:00+08:00
description: 1、web.config中配置阿里云云存储配置信息<add key="Ali_OSS_AccessKeyID" value="" /> <add key="Ali_OSS_AccessKeySecret" value="" /> <add key="Ali_OSS_BucketName" value="" /> <add key="Ali_OSS_BucketName" value="" />2、上传文件（图片）//获取上传图片 HttpPostedFileBase file = Request.Files["file0"]; if (file != null && file.ContentLength > 0) { OSS.Storage sotre = new OSS.Storage(); ImageUrl= sotre.Upload(file.FileName, file.InputStream,"Product/"); }3、阿里云云存储操作类库using Aliyun.OSS; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Als.Utils.String; namespace Als.Utils.External.Ali { public static class OssStorage { public static string AccessKeyId { get; set; } = "Ali_OSS_AccessKeyID".ValueOfAppSetting(); public static string AccessKeySecret { get; set; } = "Ali_OSS_AccessKeySecret".ValueOfAppSetting(); public static string BucketName { get; set; } = "Ali_OSS_BucketName".ValueOfAppSetting(); public static string EndPoint { get; set; } = "Ali_OSS_BucketName".ValueOfAppSetting(); #region 默认配置信息上传文件 /// /// 上传文件 /// /// 文件名 /// 文件流 public static void Upload(string fileName, Stream fileStream) { var ossClient = new OssClient(EndPoint, AccessKeyId, AccessKeySecret); var metadata = new ObjectMetadata { ContentType = GetContentType(fileName) }; //根据文件名设置ContentType var key = "MerLogo/" + fileName; fileStream.Seek(0, SeekOrigin.Begin); ossClient.PutObject(BucketName, key, fileStream, metadata); } /// /// 上传文件并返回结果 /// /// 文件名 /// 文件流 public static PutObjectResult UploadGetResult(string fileName, Stream fileStream) { var ossClient = new OssClient(EndPoint, AccessKeyId, AccessKeySecret); var metadata = new ObjectMetadata(); //根据文件名设置ContentType metadata.ContentType = GetContentType(fileName); var key = "MerLogo/" + fileName; fileStream.Seek(0, SeekOrigin.Begin); return ossClient.PutObject(BucketName, key, fileStream, metadata); } /// /// 上传文件 /// /// /// /// /// <returns>返回存储后文件路径</returns> public static string Upload(strin…

.NET线程操作类使用说明
type: item
date: 2018-11-11T13:54:00+08:00
description: 1、创建线程中运行的方法体public void Func(object state) { lock(obj) { ..... } }2、运行线程操作类public void FuncTask(object state) { ManagedTreadPool.QueueUserWorkItem(new WaitCallback(Func),state) }3、附线程操作类库using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace Als.Utils.Task { /// ///用C#托管代码实现的线程池 /// 它在管理线程的时候，有一个缓存线程的池，即一个ArrayList对象 /// 它一开始就初始化了一定数量的线程，并通过ProcessQueuedItems方法保证异步执行进入池中的队列任务 /// 这样在分配异步任务的时候，就省去了频繁去创建（new）一个线程 /// public class ManagedThreadPool { #region Constants /// Maximum number of threads the thread pool has at its disposal. private const int _maxWorkerThreads = 10; #endregion #region Member Variables /// Queue of all the callbacks waiting to be executed. private static Queue _waitingCallbacks; /// /// Used to signal that a worker thread is needed for processing. Note that multiple /// threads may be needed simultaneously and as such we use a semaphore instead of /// an auto reset event. /// private static Semaphore _workerThreadNeeded; /// List of all worker threads at the disposal of the thread pool. private static ArrayList _workerThreads; /// Number of threads currently active. private static int _inUseThreads; /// Lockable object for the pool. private static object _poolLock = new object(); #endregion #region Construction and Finalization /// Initialize the thread pool. static ManagedThreadPool() { Initialize(); } /// Initializes the thread pool. private static void Initialize() { // Create our thread stores; we handle synchronization ourself // as we may run into situtations where multiple operations need to be atomic. // We keep track of the threads we've created just for good measure; not actually // needed for any core functionality. _waitingCallbacks = new Queue(); _workerThreads = new ArrayList(); _inUseThreads = 0; // Create our "thread needed" event _workerThreadNeeded = new Semaphore(0); // Create all of the worker threads for (int i = 0; i < _maxWorkerThr…

.NET中System.Web.Caching.Cache缓存
type: item
date: 2016-08-27T11:40:00+08:00
description: 今天在整理类库，正好弄到缓存这边，就找找资料看一下。System.Web.Caching.Cache是微软提供的一个Web下的类库，Cache类，是一个用于缓存常用信息的类。HttpRuntime.Cache以及HttpContext.Current.Cache都是该类的实例。查看一个类就是从它的属性、方法等方面查看，只有了解的属性，才能明白各个方法是做什么用的。一、属性二、方法三、静态字段namespace CacheDemo { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Person p = new Person(); p.Id = 1; p.Name = "masoft"; Cache cache = HttpRuntime.Cache; cache.Insert("A",p); cache.Insert("B","字符串"); Response.Write(cache.Get("B").ToString()); //输出 字符串 Person p2 = cache["A"] as Person; Response.Write(p2.Id + " : " + p2.Name); //输出 1 : masoft Response.Write(cache.EffectivePrivateBytesLimit); //-1 只读属性 Response.Write(cache.EffectivePercentagePhysicalMemoryLimit); //98 开始移除项之前可以使用到98% Response.Write(cache.Count); //输出 3 Response.Write(cache["B"]); //输出 字符串 支持索引器式的读取 cache.Remove("BB"); //从cache中移除一项 Response.Write("~~~" + cache["B"] + "~~~"); //移除了输出 null，但程序不报错 foreach (var obj in cache) { Response.Write(obj.GetType() + " "); } } } public class Person { public int Id { get; set; } public string Name { get; set; } } }四、文件缓存依赖文件依赖已更改缓存就被清除五、绝对过期时间NoSlidingExpiration 绝对过期时间，当超过设定时间，立即移除。六、滑动过期时间NoAbsoluteExpiration 当超过设定时间没再使用时，才移除缓存七、缓存优先级[scode type="share"]//在服务器释放系统内存时，具有该优先级级别的缓存项最有可能被从缓存删除。Low = 1,//在服务器释放系统内存时，具有该优先级级别的缓存项比分配了 System.Web.Caching.CacheItemPriority.Normal//优先级的项更有可能被从缓存删除。BelowNormal = 2,//在服务器释放系统内存时，具有该优先级级别的缓存项很有可能被从缓存删除，其被删除的可能性仅次于具有 System.Web.Caching.CacheItemPriority.LowNormal = 3,//缓存项优先级的默认值为 System.Web.Caching.CacheItemPriority.Normal。Default = 3,//在服务器释放系统内存时，具有该优先级级别的缓存项被删除的可能性比分配了 System.Web.Caching.CacheItemPriority.Normal//优先级的项要小。AboveNormal = 4,//在服务器释放系统内存时，具有该优先级级别的缓存项最不可能被从缓存删除。High = 5,//在服务器释放系统内存时，具有该优先级级别的缓存项将不会被自动从缓存删除。但是，具有该优先级级别的项会根据项的绝对到期时间或可调整到期时间与其他项一起被移除NotRemovable = 6,[/scode]八、缓存移除通知应用程序Add方法的最后一个参数，委托。九、数据库依赖缓存需要配置数据库缓存模式（详情查看本文来源：http://www.cnblogs.com/kissdodog/archive/2013/05/07/3064895.html）十、组合依赖缓存当依赖的内容为多个Dependency时，可以通过AggregateCacheDependency创建依赖的组合，以便…

ASP.NET网站开发中Web.config文件节点
type: item
date: 2016-07-26T09:11:00+08:00
description: 今天逛CNBLOGS，看到一篇关于ASP.NET中Web.config配置文件的基本使用方法。我感觉挺有用处的，我就转载一下。以后有需要可以查阅一下。该文章是作者花了点时间整理的。很适合新手参看，由于Web.config在使用很灵活，可以自定义一些节点。所以这里只介绍一些比较常用的节点。<?xml version="1.0"?> <!--注意: 除了手动编辑此文件以外，您还可以使用 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的“网站”->“Asp.Net 配置”选项。 设置和注释的完整列表在 machine.config.comments 中，该文件通常位于 "Windows"Microsoft.Net"Framework"v2.x"Config 中。--> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> </sectionGroup> </sectionGroup> </configSections> <appSettings> <add key="1" value="1" /> <add key="gao" value="weipeng" /> </appSettings> <connectionStrings> <add name="ConnString" connectionString="Data Source=GAO;Initial Catalog=HBWXDate;User ID=sa;password=sa"></add> <add name="111" connectionString="11111" /> </connectionStrings> <location path="Default.aspx" allowOverride="false"> <system.web> <identity impersonate="false" /> <!--标识特定于页的配置设置（如是否启用会话状态、视图状态，是否检测用户的输入等）。<pages>可以在计算机、站点、应用程序和子目录级别声明. 这里的几个属性的意思是默认主页为Index,主题是Default，不检测用户在浏览器输入的内容中是否存在潜在的危险数据（注：该项默认是检测，如果你使用了不检测，一要对用户的输入进行编码或验证)，在从客户端回发页时将检查加密的视图状态，以验证视图状态是否已在客户端被篡改。(注：该项默认是不验证）禁用ViewState--> <pages masterPageFile="Index" theme="Default" buffer="true" enableViewStateMac="true" validateRequest="false" enableViewState="false"> <controls></controls> <namespaces></namespaces> </pages> <customErrors defaultRedirect="Err.html" mode="RemoteOnly"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> <trace enabled="true" localOnly="false" pageOutput="true" requestLimit="15" traceMode="SortByCategory"/> <compilation debug="true" defaultLanguage="c#" batch="false"> <assemblies> <add as…