我希望用戶把這個鏈接重定向以能夠傳遞變量從MVC控制器參數
public ActionResult GoogleMapAddress(string address, string Area, string city, string zipCode)
{
return Redirect(string.Format(" https://www.google.co.za/maps/search/{0}/ ", address + Area + city + zipCode));
}
的視圖重定向到外部URL
@Html.ActionLink("Address", "GoogleMapAddress", "Orders", new { address="test", Area="test", city="test", zipCode="test" },new {target="_blank" })
目前的方法,我有添加Url鏈接到本地主機鏈接。其中給出錯誤 - 「從客戶端(:)發現潛在危險的Request.Path值。」 和URL鏈接(谷歌)一旦予除去添加的本地主機鏈路
使用它,因爲你是手動生成的URL之前驗證構造的URL,你需要使用' Url.Encode(地址+區域+城市+ zipCode)' – haim770
您需要在連接地址後使用'Response.Redirect(url)' – Monah
爲什麼當客戶端已經擁有所需的所有信息時只發出一個JS重定向? –