2012-01-21 56 views
3

我正在使用asp.net開發Web應用程序。有一個文本框包含一個HTML或XML文件(從服務器加載)。驗證文件後,我想將該文件存儲在用戶希望保存的位置(客戶端),並且用戶只能以HTML或XML格式保存。 我開發了一個代碼,但它會自動保存,而不會詢問用戶。保存用戶想要的文件,並且僅使用HTML或XML格式

protected void btnsave_Click(object sender, EventArgs e) 
    { 
     string getnote = txtdisplay.Text.Trim(); 
     String filepath = Server.MapPath(@"img\new1.txt"); 
     System.IO.FileStream ab = new System.IO.FileStream(filepath, System.IO.FileMode.Create); 
     System.IO.StreamWriter Write101 = new System.IO.StreamWriter(ab); 
     Write101.WriteLine(getnote); 
     Write101.Close(); 
    } 

任何幫助表示讚賞

回答

相關問題