易截截图软件、单文件、免安装、纯绿色、仅160KB

Asp.Net下的文件上传功能实现

刚学习.Net没有多长时间,以前都是看别人的文章,学习前辈们的经验和技巧,自己受益匪浅。今天也来个原创的,发个文件上传的代码。主要实现的功能有:1.可以控制允许上传的文件类型;2.上传之后自动以时间命名;3.自动创建上传文件要保存的目录。
不足之处:没有对允许上传的文件大小做限制。其他不足之处还望各位指出,以便改进。第一次发文章,鲜花、砖头自己准备!呵呵~~~
要引入命名空间 System.IO;
#region 上传文件
    protected void btn_upload_Click(object sender, EventArgs e)
    {
        bool fileOK = false;
        //文件的上传路径
        string path = Server.MapPath("~/UpLoadFiles/Files/");
        //判断上传文件夹是否存在,若不存在,则创建
        if (!Directory.Exists(path))
        {
            //创建文件夹
            Directory.CreateDirectory(path);
        }
        if (upload.HasFile)
        {
            //如果选择了文件则执行
            //获取上传文件的类型
            string fileExtesion = System.IO.Path.GetExtension(upload.FileName).ToLower();
            //允许上传的类型
            string[] allowExtesions = { ".doc", ".xls", ".rar", ".zip", ".ppt" };
            for (int i = 0; i < allowExtesions.Length; i++)
           


相关文档:

ASP.NET中常用的三十三种代码

1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Attributes.Add("o ......

ASP.net 类和属性的问题

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Sy ......

ASP.NET AJAX调用WebService

如何在客户端直接调用WebService中的方法?
这里结合经验自己写一写
1.首先新建一个 ASP.NET AJAX-Enabled Web Site,这样系统为我们自动配置好了环境,这主要体现在Web.config这个文件上,如果已有网站不是ASP.NET AJAX-Enabled Web Site也可以对照修改下Web.config,也可以达到相同的效果。
2.新建一个web服务,WebSer ......

Windows 2003中配置ASP.Net环境

大家知道,Microsoft为了更好地预防恶意用户和攻击者的攻击,在默认情况下,没有将 IIS6.0 安装到 Windows Server 2003 家族的成员上。而且,当我们最初安装 IIS6.0 时,该服务在高度安全和"锁定"模式下安装。在默认情况下,IIS6.0 只为静态内容提供服务即,诸如 ASP、ASP.NET、在服务器端的包含文件、WebDAV 发布和 FrontP ......

JSON Serialization and Deserialization in ASP.Net


    
JSON Serialization and Deserialization in ASP.Net
 
I was looking around for a simple example which would just do an object serialization to a JSON format, and then deserializing back to the original object. I found few examples on MSDN, but did seem to be too long ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号