asp.net 小技巧

來源:互聯網
上載者:User
GridView中資料列的內容太長的時候經常會出現換行
轉換成模板列,在內容兩邊加上 <nowrap> </nowrap>

讓   FileUpload   文字框唯讀

C# code
<asp:FileUpload runat="server" style="height:20px;" unselectable="on" ID="fileUpdate" />
Cookie中的資料以文本的形式存在用戶端電腦,考慮它的安全性,最好在將資料存入Cookie之前對其進行加密。
加密的方法很多,比較簡單一點的有:Base64,md5,sha等,而相對比較複雜一點的有:DES,TripleDES,RC2,Rijndael等。
下面是的代碼實現了將資料存入Cookie之前採用散列的演算法進行加密.
Private   void   Login_Click(object   sender,System   EventArgs   e)
{
string   Name   =   NameBox.Text;
string   Pass   =   PassBox.Text;
Response.Cookies[ "name "].Value   =   FormsAuthentication.HashPasswordForStoringInConfigFile(Name,   "md5 ");
                Response.Cookies[ "pass "].Value   =   FormsAuthentication.HashPasswordForStoringInConfigFile(Pass,   "md5 ");
}
加密的方法很多,使用比較複雜的密碼編譯演算法,安全性比較高些,但佔用伺服器資源比較大,會減慢整個網站的訪問速度。
所以對Cookie加密在考慮三個方面:1:安全性,2:Cookie容量,3:整個網站的效能。









ENTER鍵可以讓游標移到下一個輸入框
<input   onkeydown= "if(event.keyCode==13)event.keyCode=9 ">



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="26_虛線效果.aspx.cs" Inherits="_26_虛線效果" %><!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><%-- 方法二--%><STYLE type=text/css>.dotline {BORDER-BOTTOM-STYLE: dotted; BORDER-LEFT-STYLE: dotted; BORDER-RIGHT-STYLE: dotted; BORDER-TOP-STYLE: dotted}</STYLE></head><body><form id="form1" runat="server"><div><hr style="BORDER-BOTTOM-STYLE: dotted; BORDER-LEFT-STYLE: dotted; BORDER-RIGHT-STYLE: dotted; BORDER-TOP-STYLE: dotted" color=#000000 size=1 />方法2:<hr class=dotline color=green size=1 /></div></form></body></html>

<input   type= "file "   onchange= "javascript:document.getElementById( 'image ').src=this.value "/>
<input   type= "image "   src= " "   id= "image "/>
這樣在選中要上傳的圖片時,就可以看見自己要上傳的了
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.