757
技術社區[雲棲]
asp.net提交文件處理
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
string strPath = context.Server.MapPath("hello2.htm"); //獲取文件的路徑
context.Response.Write(strPath); //輸出路徑
string strContents = System.IO.File.ReadAllText(strPath);//獲取文件的內容
context.Response.Write(strContents); //輸出一個網頁
string strUserName = context.Request["txtUserName"]; //獲取用戶名
if (string.IsNullOrEmpty(strUserName)) //判斷是否存在用戶名
{
context.Response.Write("直接進入 --welcome, " + strUserName);
}
else
{
context.Response.Write("提交進入 --welcome, " + strUserName);
}
}
最後更新:2017-04-02 00:06:56