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