Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Tip/Trick: Url Rewriting with ASP.NET

 
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications.  This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have the option to structure the URLs of your application however you want.
Why does URL mapping and rewriting matter?
The most common scenarios where developers want greater flexibility with URLs are:
1) Handling cases where you want to restructure the pages within your web application, and you want to ensure that people who have bookmarked old URLs don't break when you move pages around.  Url-rewriting enables you to transparently forward requests to the new page location without breaking browsers.
2) Improving the search relevancy of pages on your site with search engines like Google, Yahoo and Live.  Specifically, URL Rewriting can often make it easier to embed common keywords into the URLs of the pages on your sites, which can often increase the chance of someone clicking your link.  Moving from using querystring arguments to instead use fully qualified URL's can also in some cases increase your priority in search engine results.  Using techniques that force referring links to use the same case and URL entrypoint (for example: weblogs.asp.net/scottgu instead of weblogs.asp.net/scottgu/default.aspx) can also avoid diluting your pagerank across multiple URLs, and increase your search results.
In a world where search engines increasingly drive traffic to sites, extracting any little improvement in your page ranking can yield very good ROI to your business.  Increasingly this is driving developers to use URL-Rewriting and other SEO (search engine optimization) techniques to optimize sites (note that SEO is a fast moving space, and the recommendations for increasing your search relevancy evolve monthly).  For a list of some good


Ïà¹ØÎĵµ£º

¹ØÓÚasp.net Session¶ªÊ§ÎÊÌâµÄ×ܽá


˳±ãÌáÒ»ÏÂaspÖÐSessionµÄ¹¤×÷Ô­Àí£º
aspµÄSessionÊǾßÓнø³ÌÒÀÀµÐԵġ£ASP Session״̬´æÓÚIISµÄ½ø³ÌÖУ¬Ò²¾ÍÊÇinetinfo.exeÕâ¸ö³ÌÐò¡£ËùÒÔµ±inetinfo.exe½ø³Ì±ÀÀ£Ê±£¬ÕâЩÐÅÏ¢Ò²¾Í¶ªÊ§¡£ÁíÍ⣬ÖØÆð»òÕ߹رÕIIS·þÎñ¶¼»áÔì³ÉÐÅÏ¢µÄ¶ªÊ§¡£
asp.net SessionµÄʵÏÖ
asp.netµÄSessionÊÇ»ùÓÚHttpModule¼¼Êõ×öµÄ£¬HttpModule ......

asp.net 佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý

asp.net 佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý¡£
¾­³£Åöµ½Õâ¸öÎÊÌâ¡£ÎÊÌâµÄÔ­Òò´ó¸ÅÓÐÒÔϼ¸µã¡£
1¡¢ViewState ¶ÔÏóΪNull¡£
2¡¢DateSet ¿Õ¡£
3¡¢sqlÓï¾ä»òDatebaseµÄÔ­Òòµ¼ÖÂDataReader¿Õ¡£
4¡¢ÉùÃ÷×Ö·û´®±äÁ¿Ê±Î´¸³¿ÕÖµ¾ÍÓ¦ÓñäÁ¿¡£
5¡¢Î´ÓÃnew³õʼ»¯¶ÔÏó¡£
6¡¢Session¶ÔÏóΪ¿Õ¡£
7¡¢¶Ô¿Ø¼þ¸³Îı¾ÖµÊ±,Öµ²»´æÔÚ
8¡¢Ê¹Óà ......

ÈçºÎÔÚAsp.netʹÓÃģʽ¶Ô»°¿òÌá½»¶ø²»´ò¿ªÐ´°¿Ú£¿

ÔÚÏîÄ¿ÖÐÎÒÒªÓõ½ÐÞ¸ÄÃÜÂ빦ÄÜ£¬ÐÞ¸ÄÃÜÂëÒ³ÎÒÊÇÓÃģʽ¶Ô»°¿òµÄÐÎʽµ¯³öÀ´µÄ£¬µ±ÎÒ°´Õý³£Çé¿öÌá½»Êý¾Ýʱ£¬·¢ÏÖËü»áµ¯³öÒ»¸öеĴ°¿ÚÀ´ÏÔʾÐ޸ijɹ¦ÐÅÏ¢£¬ÎÒÏëÌá½»Êý¾Ý¶ø²»´ò¿ªÐ´°¿Ú£¬
ÎҵĽâ¾ö°ì·¨¾ÍÊÇÔÚhead±êÇ©ÖмÓÉÏbase±êÇ©ÈÃtarget="_self",֮ǰÎÒÏëµÃÓе㸴ÔÓ£¬Ïë¸øËüÒ»¸ö¹Ì¶¨µÄalert£¬µ±³É¹¦ÐÞ¸Äʱ²ÅÏÔʾ ......

VS2005µ÷ÊÔasp.net³ÌÐòʱ³öÏÖ

VS2005µ÷ÊÔasp.net³ÌÐòʱ³öÏÖ----Internet Explorer ÎÞ·¨ÏÔʾ¸ÃÒ³Ãæ
ÈçͼËùʾ£º
Ç°¶Îʱ¼ä¿ÉÒÔµ÷ÊԵģ¬Ë­Öª×òÍíͻȻ²»ÐÐÁË£¬ÕÒÁ˺þã¬ÖÕÓÚÕÒµ½½â¾ö·½°¸¡£ÓõÄÊÇVS2005£¬Îļþϵͳ£¬ÔÚIISÀïÃæÉèÖõĻ°£¬¿ÉÒÔÔËÐУ¬´úÂëûÎÊÌ⣬Êý¾Ý¿âÁ¬½ÓûÎÊÌâ¡£
·½°¸Ò»£ºÍ¨¹ýÓÒ»÷ASP.NET Development Server£¬Èçͼ£º
´ò¿ª1£¬ÔÚĬÈÏä¯ÀÀÆ ......

ASP.NETÁ¬½Ó¸÷ÀàÊý¾Ý¿â¼¯½õ

1.C#Á¬½ÓÁ¬½ÓAccess
³ÌÐò´úÂë:
------------------------------------------------------------------------------- using System.Data;
using System.Data.OleDb;
..
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:BegASPNETNorthwind.mdb";
Ol ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ