代码很简单,就不罗唆了。
C#:
<%@ Page Language="C#" AutoEventWireup="true" %><!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>不经保存,直接读取上传文件的内容</title>
</head>
<body>
<form id="MengXianhui" runat="server">
<asp:fileupload ID="FileUpload1" runat="server" />
<asp:button ID="btnUpload" runat="server" Text="上传" OnClick="btnUpload_Click"></asp:button>
<p>
<asp:label ID="Msg" runat="server" ForeColor="Red"></asp:label></p>
</form>
</body>
</html>