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

ASP.NET MVC Uploading and Downloading Files


If you come to ASP.NET MVC from a purely ASP.NET Web Forms background, one of the first things you are likely to notice is that all those nice easy Server Controls have disappeared. One of those is the FileUpload, and its absence seems to cause a few problems. This article looks at how to upload files to the server in an MVC world, and how to get them back from the server to the user again.
 
In Web Forms, when you drag a FileUpload control on to the designer, something happens when the page is rendered which you probably don't notice. The resulting html form that wraps the entire page is decorated with an extra attribute: enctype="multipart/form-data". The FileUpload itself is rendered as an html input type=file. Within an MVC View, there are a number of ways to set this up. The first is with HTML:
<form action="/" method="post" enctype="multipart/form-data">
<input type="file" name="FileUpload1" /><br />
<input type="submit" name="Submit" id="Submit" value="Upload" />
</form>
Notice that the <form> tag includes the enctype attribute, and method attribute of post. This is needed because the form by default will be submitted via the HTTP get method.  The following approach, using the Html.BeginForm() extension method renders the exact same html when the page is requested:
<%
using (Html.BeginForm("", "home", FormMethod.Post, new {enctype="multipart/form-data"}))
{%>
<input type="file" name="FileUpload1" /><br />
<input type="submit" name="Submit" id="Submit" value="Upload" />
<% }%>
Notice the name attribute of the <input type="file"> element. We'll come back to that shortly. In the meantime, the resulting page should look rather blandly like this:
OK. So we can now browse to a local file and click the submit button to upload it to the web server. What is needed next is some way to manage the file on the server. W


相关文档:

ASP.NET ASP.NET 网页的 HTML 控件


      本节中的主题描述如何使用 Visual Web Developer 工具箱的“HTML”选项卡上的 ASP.NET Web 服务器控件。
默认情况下,服务器无法使用 ASP.NET 网页上的 HTML 元素;这些元素被视为传递给浏览器的不透明文本。但是,通过将 HTML 元素转换成 HTML 服务器控件,可以将它们公开为 ......

新手怎么学习asp.net

------本文转载自网络,所有权归作者所有
如果你已经有较多的面向对象开发经验,跳过以下这两步:
第一步 掌握一门.NET面向对象语言,C#或VB.NET。
我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET。
ASP.NET是一个全面向对象的技术,不懂OO,那绝对学不下去!
第二步 对.NET Framework类库有一 ......

邮件发送控件jmail使用方法之ASP.NET示例

    准备工作和WinForm程序中应用的差不多:
    1.首先下载jmail控件,然后安装(其实不安装也行,只要你能找到jmail.dll文件,然后注册该dll文件。这里不支持上传附件,否则我就把我下载的传上来了),附上手工注册它的批处理:
echo off
copy jmail.dll C:\windows\system32
regsvr32 ......

ASP.NET面试经历分享

200X年12月23日的一次面试经历(共六轮),至此9-X周年之际,和各位朋友分享,希望对各位朋友有用,有些自己的答案贴出来也仅仅是抛砖引玉,希望各位朋友不吝赐教,说句老实话,面试的时候时间很紧,很难考虑最优算法。
起因是朋友推荐我去W公司应聘Senior SDE这个职位,应该算是内部推荐了,下面是招聘要求
Title: Senio ......

ASP.NET对请求处理的过程

ASP.NET对请求处理的过程
当请求一个*.aspx文件的时候,这个请求会被inetinfo.exe进程截获,它判断文件的后缀(aspx)之后,将这个请求转交给 ASPNET_ISAPI.dll,ASPNET_ISAPI.dll会通过http管道(Http PipeLine)将请求发送给ASPNET_WP.exe进程,在ASPNET_WP.exe进程中通过HttpRuntime来处理这个请求,处理完毕将结果返回 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号