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();
}
Ïà¹ØÎĵµ£º
ÔÚasp.netÖе¼³öexcel ÖбȽÏͨÐеÄ×ö·¨ÊÇ: Response.ContentType = "application/vnd.ms-excel";
È»ºóÖ±½ÓÏòÀïÃæÈÓ html µÄtable
µ«ÊÇÓÐÖÐÎĵÄʱºò ÀϳöÏÖÂÒÂ룬Óкܶà½â¾ö·½°¸£¬µ«¶¼²»ÄÜͨÅ̽â¾ö, ¾ÍÊÇÔÚ Êä³öhtmlÁ½Í·Êä³ö
Response.Write("<html><head><meta http-equiv=Content-Type conte ......
URL ÖØÐ´ÊǽØÈ¡´«Èë Web ÇëÇó²¢×Ô¶¯½«ÇëÇóÖØ¶¨Ïòµ½ÆäËû URL µÄ¹ý³Ì¡£
±ÈÈçä¯ÀÀÆ÷·¢À´ÇëÇóhostname/101.aspx £¬·þÎñÆ÷×Ô¶¯½«Õâ¸öÇëÇóÖж¨ÏòΪhttp://hostname/list.aspx?id=101¡£
urlÖØÐ´µÄÓŵãÔÚÓÚ£º
Ëõ¶Ìurl£¬Òþ²ØÊµ¼Ê·¾¶Ìá¸ß°²È«ÐÔ
Ò×ÓÚÓû§¼ÇÒäºÍ¼ ......
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
namespace Maticsoft.DBUtility
{
/// <summary>
  ......
Ò»¡£¢Ù£ºÊ×ÏÈÒªÓÐÕâ¸öÎļþURLRewriter.dll,Èç¹ûûÓÐ,¸Ï¿ìµ½ÍøÉÏÏÂÔØÒ»¸ö,²¢½«Æä·Åµ½ÏÂÃæµÄbinĿ¼ÀïÃæ,²¢ÇÒ½«ÆäÒýÓÃÌí¼Óµ½ÏÂÃæÀïÃæ;
¢Ú£ºÏÂÃæ¾ÍÊÇWeb.ConfigÎļþµÄÅäÖÃÁË,µ±È»,ÅäÖùý³ÌÏ൱¼òµ¥£º
1£ºÏÈÌí¼ÓÕâ¸ö
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.Rew ......