C#½âÎöHTML
ÔÚËÑË÷ÒýÇæµÄ¿ª·¢ÖУ¬ÎÒÃÇÐèÒª¶ÔÍøÒ³µÄHtmlÄÚÈݽøÐмìË÷£¬ÄÑÃâµÄ¾ÍÐèÒª¶ÔHtml½øÐнâÎö¡£²ð·Öÿһ¸ö½Úµã²¢ÇÒ»ñÈ¡½Úµã¼äµÄÄÚÈÝ¡£´ËÎĽéÉÜÁ½ÖÖC#½âÎöHtmlµÄ·½·¨¡£
µÚÒ»ÖÖ·½·¨£º
ÓÃSystem.Net.WebClientÏÂÔØWeb Page´æµ½±¾µØÎļþ»òÕßStringÖУ¬ÓÃÕýÔò±í´ïʽÀ´·ÖÎö¡£Õâ¸ö·½·¨¿ÉÒÔÓÃÔÚWeb CrawlerµÈÐèÒª·ÖÎöºÜ¶àWeb PageµÄÓ¦ÓÃÖС£
¹À¼ÆÕâÒ²ÊÇ´ó¼Ò×îÖ±½Ó£¬×îÈÝÒ×Ïëµ½µÄÒ»¸ö·½·¨¡£
ת×ÔÍøÉϵÄÒ»¸öʵÀý£ºËùÓеÄhref¶¼³éÈ¡³öÀ´£º
Code
using System;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace HttpGet
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
System.Net.WebClient client = new WebClient();
byte[] page = client.DownloadData("http://www.google.com");
string content = System.Text.Encoding.UTF8.GetString(page);
string regex = "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?[\\\"\\\']";
Regex re = new Regex(regex);
MatchCollection matches = re.Matches(content);
System.Collections.IEnumerator enu = matches.GetEnumerator();
while&nbs
Ïà¹ØÎĵµ£º
ÄãÊ×ÏÈÒªÀí½âһϸÅÄ
Ò» ÀàÐÍ(Type) ¶ÔÏóÊÇʲô
±ÈÈç object x; xÊǶÔÏó£¬object¾ÍÊÇËüµÄÀàÐÍ£¬ÔÚ³ÌÐòÖÐÈçºÎÃèÊöÀàÐÍÕâ¸ö¸ÅÄîÄØ£¿
¾ÍÊÇType(System.Type)¡£Òª»ñȡij¸öÀàµÄÀàÐÍ¿ÉÒÔÓÃtypeof()²Ù×÷·û
object a;object b; DataTable t;
aType = typeof(object);Type bType = typeof(object);tType = typ ......
1 ´´½¨C# DLL£¬ÐèÒªÖ¸¶¨Ó¦ÓÃÀàÐÍΪ“Àà¿â”£¬´úÂ룺
namespace CSLib
{
public class Class1
{
private string name;
public string Name
......
1. ÔÚoracle Ï´´½¨±í
t_user(
ID varchar(20),
Name varchar(20)
)
2. Ìí¼ÓÊý¾Ý
&nb ......
ÏÖÔÚµÄÍøÒ³ÓÐÏ൱һ²¿·ÖÊDzÉÓÃÁËAJAX¼¼Êõ,²»¹ÜÊDzÉÓÃC#ÖеÄWebClient»¹ÊÇHttpRequest¶¼µÃ²»µ½ÕýÈ·µÄ½á¹û,ÒòΪÕâЩ½Å±¾ÊÇÔÚ·þÎñÆ÷·¢ËÍÍê±Ïºó²ÅÖ´ÐеÄ!
µ«ÎÒÃÇÓÃIEä¯ÀÀÒ³ÃæʱÊÇÕý³£µÄ,ËùÒÔ½â¾ö·½·¨Ö»ÓÐ1¸ö¾ÍÊDzÉÓÃWebBrowser¿Ø¼þ
µ«ÊÇʹÓÃWebbrowserÄã»á·¢ÏÖ,ÔÚDownloadCompleteʼþÖÐ,Äã¸ù±¾ÎÞ·¨ÖªµÀÒ³ÃæºÎʱ²ÅËãÊÇÕæÕýµ ......
Õâƪ½Ì³Ì̽ÌÖASP.NET MVC¿ØÖÆÆ÷£¬¿ØÖÆÆ÷actionºÍaction result¡£Íê³É´Ë½Ì³Ìºó£¬Äã»á¶®µÃ¿ØÖÆÆ÷ÈçºÎ±»ÓÃÀ´¿ØÖÆ·ÃÎÊÕßÓëASP.NET MVCÍøÕ¾µÄ½»»¥·½Ê½¡£
Àí½â¿ØÖÆÆ÷
MVC ¿ØÖÆÆ÷¸ºÔð¶ÔASP.NET MVCÍøÕ¾µÄÇëÇó×÷³ö»ØÓ¦¡£Ã¿Ò»¸öä¯ÀÀÆ÷ÇëÇ󶼱»Ó³Éäµ½Ò»¸öÌض¨µÄ¿ØÖÆÆ÷¡£ÀýÈ磬ÏëÏóÄãÔÚä¯ÀÀÆ÷µØÖ·À¸ÊäÈëÒÔÏÂURL:
http://localhost/P ......