惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
L
LangChain Blog
WordPress大学
WordPress大学
V
V2EX
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
Recent Announcements
Recent Announcements
GbyAI
GbyAI
博客园 - 叶小钗
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog

博客园 - David

最近比较烦 网络安全管理---三分技术加上七分管理 DataGrid点击删除按钮弹出确认对话框一个好办法 asp.net常用函数 Container.DataItem几种方式. 再贴一个菜单的例子 菜单或浮动窗口被Select等对象遮盖的解决方案 使用缓存时候,发现Page_load只能运行一次的解决方法。 对URL中的参数验证,防止用户恶意改变差数值。 常见木马端口 超时时间已到。在操作完成之前超时时间已过 令人苦笑的诺顿防火墙 IIS5 中内部错误解决方法 正则表达式学习 公司文件服务器管理,让用户快速找到需要的文件。 域名相关知识 字节换算关系 Sql2000中DateName的使用来获取年和月。 对下拉控件的绑定
Asp.net上传文件限制,在大于5M的时候出现DNS解析错误,解决...
David · 2004-12-16 · via 博客园 - David

在利用
private void Upload_Click(object sender, System.EventArgs e)
  {
   if(this.File1.PostedFile.ContentLength != 0 && this.File1.PostedFile.ContentLength < (50*1024*1024))
   {
    
    
    string strUploadFold = "/upload/";
    string strFileName = this.File1.PostedFile.FileName;
    int intPosition = strFileName.LastIndexOf("\\");
    strFileName = strFileName.Substring(intPosition+1);
    string strSavePosition = Request.MapPath(strUploadFold)+strFileName;
    this.File1.PostedFile.SaveAs(strSavePosition);
    this.Infor1.Text = this.File1.PostedFile.ContentLength+" = "+this.File1.PostedFile.ContentLength/(1024*1024)+"M";


   }
   else
   {
    this.Infor1.Text = "上传的文件的大小超出范围!";
   }
  
  }
  上传文件的时候,发现如果文件超过了5M就不能上传成功。
解决方法:在<system.web>中加入
<httpRuntime maxRequestLength="10240" /> 这个是控制指示 ASP.NET 支持的最大文件上载大小。该限制可用于防止因用户将大量文件传递到该服务器而导致的拒绝服务攻击。指定的大小以 KB 为单位。默认值为 4096 KB (4 MB)。