ASP.NET ÅжÏÍøÒ³±àÂë¶ÁÈ¡ÄÚÈÝ£¬·ÀÖ¹ÂÒÂë
×î½üҪдһ¸öÔÚÍøÒ³ÖвéÕҹؼü×Ö¼°Á´½ÓµÄ³ÌÐò£¬ÔÚÊä³öµ½TextBoxµÄʱºò·¢ÏÖ¾³£³öÏÖÂÒÂ룬ÕûÀíÁËһϸù¾Ý²»Í¬µÄ±àÂëÑ¡È¡ÍøÒ³Ô´Îļþ£¬Ä¿Ç°¿ÉÒÔ½â¾ö¼¸ÖÖ³£±àÂ뷽ʽµÄÍøÒ³£¬¸ÐÐËȤµÄ¿ÉÒÔÊÔÏ¡£
±¾À´ÏëÓÓ£½£½”ÅжϱàÂ룬¸Ð¾õ±È½ÏÂé·³£¬ËùÒÔ¸ÄÓñȽÏÄ£ºýµÄ·½·¨£¬ContainsÓÃÔÚÕâÀïͦ·½±ãµÄ¡£
Contains˵Ã÷£º¾ÍÊÇ·µ»ØÒ»²¼¶ûÖµ£¬Ö¸Ê¾ÊÇ·ñµ±Ç°×Ö·û´®ÊµÀý°üº¬¸ø¶¨µÄ×Ó´®¡£
//´æ·ÅÍøÒ³µÄÔ´Îļþ
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
string contenttype = all_codeResponse.Headers["Content-Type"];//µÃµ½½á¹ûΪ"text/html; charset=utf-8"
//ÍøÒ³±àÂëÅжÏ
if (contenttype.Contains("GB2312"))
{
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream(), Encoding.GetEncoding("gb2312"));
//»ñÈ¡Ô´Îļþ
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
}
else if (contenttype.Contains("GBK"))
{
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream(), Encoding.GetEncoding("GBK"));
//»ñÈ¡Ô´Îļþ
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
}
else if (contenttype.Contains("UTF-8"))
{
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
//»ñÈ¡Ô´Îļþ
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
}
Ïà¹ØÎĵµ£º
js code //Ö÷Òª¹¦ÄÜÊÇʵÏÖ¸´Ñ¡¿òµÄÈ«Ñ¡Ôñ¸ú·ÇÈ«Ñ¡
<script type="text/javascript" defer="defer">
function OnTreeNodeChecked() {
var ele = event.srcElement;
&nbs ......
֮ǰҪÍê³ÉÒ»¸öÖ§³Ö¶àÖ§³Ö¶àÖÖ¸ñʽµÄÊÓƵ²¥·ÅÆ÷£¬ÔÚÍøÉÏÕÒµ½Ò»¸öVBдµÄ£¬È»ºó¸Ä³ÉC#£¬½ü¶ÎÔÚÍøÉÏÒ²¼ûÓв»ÉÙÈËÎÊÕâ¸öÎÊ£¬ÔÚ´Ë·ÖÏí
public class VideoPlayer
{
/// <summary>
/// Éú³ÉÊÓƵ²¥·ÅÆ÷µÄHTM ......
ASP.NET ViewState ÊÇÒ»ÖÖеÄ״̬·þÎñ£¬¿É¹©¿ª·¢ÈËÔ±»ùÓÚÿ¸öÓû§À´¸ú×Ù UI ״̬£¬¸Ã¸¨ÖúÊý¾Ý±»´æ´¢ÔÚÒ»¸öÃûΪ __VIEWSTATE µÄÒþ²Ø×Ö¶ÎÖС£
µ±È»£¬ ViewState ÔÚ ASP.NET ÖÐÓиöÖØÒªµÄ½ÇÉ«¡£Èç¹ûʹÓÃÇ¡µ±£¬ËüÄܹ»¼ò»¯Ò³Ã濪·¢£¬¸Ä½øÓû§ÓëÕ¾µãµÄ½»»¥¡£Èç¹ûÖÃÖ®²»Àí£¬ËüÄܹ»ÏÔÖøÔö¼ÓÕ¾µãÏìÓ¦´óÐ ......
ÔÚʹÓÃasp.net±àдwebserviceʱ£¬Ä¬ÈÏÇé¿öÏÂÊDz»Ö§³ÖsessionµÄ£¬µ«ÎÒÃÇ¿ÉÒÔ°ÑWebMethodµÄEnableSessionÑ¡ÏîÉèΪtrueÀ´ÏÔʽµÄ´ò¿ªËü£¬Çë¿´ÒÔÏÂÀý×Ó£º
1 н¨ÍøÕ¾WebSite
2 н¨web·þÎñWebService.asmx£¬Ëü¾ßÓÐÒÔÏÂÁ½¸ö·½·¨£º
[WebMethod(EnableSession = true)]
public string Login(string name)
{
  ......
±¾ÎĽéÉÜASP.NET´íÎó´¦Àí£¬ÒÔ¼°½éÉÜÈç¹ûÄúµÄÓ¦ÓóÌÐòÊÔͼµÇ¼Êý¾Ý¿âʱûÓгɹ¦£¬ÔòÏÔʾµÄ´íÎóÐÅÏ¢²»Ó¦¸Ã°üÀ¨ËüÕýÔÚʹÓõÄÓû§Ãû¡£
Òª´´½¨Ò³ÖеÄÈ«¾Ö´¦Àí³ÌÐò£¬Çë´´½¨ Page_Error ʼþµÄ´¦Àí³ÌÐò¡£Òª´´½¨ASP.NETÓ¦ÓóÌÐò·¶Î§µÄ´íÎó´¦Àí³ÌÐò£¬ÇëÔÚ Global.asax ÎļþÖн«´úÂëÌí¼Óµ½ Application_Error ·½·¨¡£Ö»ÒªÄúµÄÒ³»òÓ¦ ......