ASP.NET ÈçºÎÈ¡µÃ Request URL µÄ¸÷個²¿·Ö?
ÎÒ們ÔÚ開發網頁應ÓóÌʽ£¬時³£ÐèҪȥ½âÎö網Ö·(Request.Url)µÄÿ個Ƭ¶Î£¬進ÐÐһЩÅÐ斷¡£ÀýÈç說 "http://localhost:1897/News/Press/Content.aspx/123?id=1#toc
"£¬ÎÒ們ÏëҪȡµÃ網Ö·裡µÚÒ»層Ä¿錄µÄÃû×Ö(News)ÓÃÒÔÅÐ斷²»Í¬µÄ頁Ãæ標題(Page Title)¡£
ÎÒ¿´ºÜ¶àÈ˶¼ÓÃ×Ö´®µÄ IndexOf ·½·¨與 Substring ·½·¨£º
Request.Url.PathAndQuery.Substring(1, Request.Url.PathAndQuery.IndexOf("/", 1)-1)
這實ÔÚÌ«Âñ沒 .NET µÄ強´ó設計ÁË£¬ÊÂ實ÉÏÔÚ Request Îï¼þ¾ÍÒÑ經ÌṩºÜ¶à·½±ãµÄ屬ÐÔ(Property)¿É¹©È¡µÃ網Ö·µÄƬ¶Î¡£
µ×ÏÂ這張±í¾ÍÊǸ÷種¸ú Browser Request µÄ網Ö·Ïà關µÄ屬ÐÔ與Ó÷¨£º
網Ö·£ºhttp://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.ApplicationPath
/
Request.PhysicalPath
D:\Projects\Solution\web\News\Press\Content.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)
D:\Projects\Solution\web\News\Press
Request.PhysicalApplicationPath
D:\Projects\Solution\web\
System.IO.Path.GetFileName(Request.PhysicalPath)
Content.aspx
Request.CurrentExecutionFilePath
/News/Press/Content.aspx
Request.FilePath
/News/Press/Content.aspx
Request.Path
/News/Press/Content.aspx/123
Request.RawUrl
/News/Press/Content.aspx/123?id=1
Request.Url.AbsolutePath
/News/Press/Content.aspx/123
Request.Url.AbsoluteUri
http://localhost:1897/News/Press/Content.aspx/123?id=1
Request.Url.Scheme
http
Request.Url.Host
localhost
Request.Url.Port
1897
Request.Url.Authority
localhost:1897
Request.Url.LocalPath
/News/Press/Content.aspx/123
Request.PathInfo
/123
Request.Url.PathAndQuery
/News/Press/Content.aspx/123?id=1
Request.Url.Query
?id=1
Request.Url.Fragment
Request.Url.Segments
/
News/
Press/
Content.aspx/
123
ËùÒÔ當Äã¿´ÁË這張±íÖ®áᣬÄã還會ÏëÓà Request.Url.PathAn
Ïà¹ØÎĵµ£º
Ò»¡¢ASP.NET Web Service´úÂë
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
namespace WebService1
{
/// <sum ......
ASP.NET 4°üÀ¨ÁËһϵÁÐеÄÔËÐÐʱÌØÐÔ£¬¿ÉÒÔ°ïÖúÄã½øÒ»²½ÓÅ»¯ÄãµÄÍøÕ¾¡£ÆäÖÐһЩÐÂÌØÐÔ¿ÉÒÔÓÃÀ´½øÐÐSEOÓÅ»¯ÒÔÌá¸ßÍøÕ¾ÔÚËÑË÷ÒýÇæÖеÄÅÅÃûºÍȨÖØ£¬ÕâЩÌØÐÔ°üÀ¨£º
еÄPage.MetaKeywords ºÍ Page.MetaDescription ÊôÐÔ
Õë¶ÔASP.NET Web FormsµÄÐÂURLµ¼ÏòÖ§³Ö
еÄResponse.RedirectPermanent()·½·¨
ÏÂÃæÊÇÈçºÎÀûÓÃÕâÐ ......
ÎåÖÖ³£¼ûµÄASP.NET°²È«È±ÏÝ
2004-10-18 19:30×÷Õߣºmenhal ³ö´¦£º¶¯Ì¬ÍøÖÆ×÷Ö¸ÄÏÔðÈα༣º·½ÖÛ
¡¡¡¡±£Ö¤Ó¦ÓóÌÐòµÄ°²È«Ó¦µ±´Ó±àдµÚÒ»ÐдúÂëµÄʱºò¿ªÊ¼×öÆð£¬ÔÒòºÜ¼òµ¥£¬Ëæ×ÅÓ¦ÓùæÄ£µÄ·¢Õ¹£¬ÐÞ²¹°²È«Â©¶´ËùÐèµÄ´ú¼ÛÒ²ËæÖ®¿ìËÙÔö³¤¡£¸ù¾ÝIBMµÄϵͳ¿ÆѧлᣨSystems Sciences Institute£©µÄÑо¿£¬Èç¹ûµÈµ½Èí¼þ²¿ÊðÖ®ºóÔ ......
1.Ìí¼Ójsº¯Êý
function TextBoxEntered(buttton) {
if (event.which || event.keyCode) {
if ((event.which == 13) || (event.keyCode == 13)) {
document.getElementById(button).click();
return false;
}
......