asp.net webform雜記

context.Response.ContentType = "text/plain";
            string encodeFileName = HttpUtility.UrlEncode("aa.txt");//國際通用防止產生亂碼。生成ASCII
            context.Response.AddHeader("Content-Disposition", string.Format("attachment;filename=\"{0}\"", encodeFileName));//在響應頭中加上Content-Disposition,attachment表示以附件形式下載.
            context.Response.WriteFile("aa.txt");//輸出文件內容前端

 

IsPostBack屬性

//若是該屬性的取值爲true,那麼就是post請求,不然是false那麼就是get請求.若是在建好的aspx頁面中有一個<from runat="server">那麼返回給瀏覽器的HTML代碼中包含一個名稱叫__VIEWSTATE的隱藏域。那麼單擊表單中的提交按鈕時,該隱藏域的值會提交到服務端。那麼IsPostBack這個屬性就是根據__VIEWSTATE隱藏域的來進行判斷是get請求仍是POST請求。若是可以拿到該隱藏域的值表示post請求不然爲get請求.若是前端頁面中沒有__VIEWSTATE隱藏域那麼就不能用IsPostBack屬性來判斷是get請求仍是Post請求.瀏覽器


獲取分頁的數據.
select * from(select *,row_number() over(order by id) as num from UserInfo)as t where num>=1 and num<=10post

相關文章
相關標籤/搜索