早期由于搜索引擎蜘蛛的不完善,蜘蛛在爬行動態(tài)的url的時候很容易由于網(wǎng)站程序的不合理等原因造成蜘蛛迷路死循環(huán)。
所以蜘蛛為了避免之前現(xiàn)象就不讀取動態(tài)的url,特別是帶?的url
routes.Ma2):設(shè)置連接
<a href="@Url.Action("RentofficeList",new RouteValueDictionary { { "AredId",0},{"PriceId",0},{"AcreageId",0},{"SortId",0},{"SortNum",0}})">默認(rèn)排序</a>對照上面的Url模式,依次寫入?yún)?shù)賦值3):獲取參數(shù)
int areaId = GetRouteInt("AredId");//獲取參數(shù)/// <summary>/// 獲得路由中的值/// </summary>/// <param name="key">鍵</param>/// <param name="defaultValue">默認(rèn)值</param>/// <returns></returns>protected int GetRouteInt(string key, int defaultValue){return Convert.ToInt32(RouteData.Values[key], defaultValue);}/// <summary>/// 獲得路由中的值/// </summary>/// <param name="key">鍵</param>/// <returns></returns>protected int GetRouteInt(string key){return GetRouteInt(key, 0);}根據(jù)上面3個步驟操作,顯示的url地址為:
http://localhost:3841/rentofficelist/3-0-0-0-0.html這樣就可以避免靜態(tài)頁面上使用動態(tài)參數(shù),顯示的頁面都為靜態(tài)頁面
新聞熱點(diǎn)
疑難解答
圖片精選