Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在razor href中使用外部url_C#_Asp.net_Razor - Fatal编程技术网

C# 在razor href中使用外部url

C# 在razor href中使用外部url,c#,asp.net,razor,C#,Asp.net,Razor,使用WebMatrix中的网页,我想将用户发送到google地图,但如果不出现以下错误,我无法使用外部url: 潜在危险的请求。从客户端检测到路径值: 我设置了一个值表,address列会将用户带到谷歌地图 <tbody> @foreach(var item in rowItems) { var addr = item.AddressDisplay; var url = "@http://maps.google.

使用WebMatrix中的网页,我想将用户发送到google地图,但如果不出现以下错误,我无法使用外部url:

潜在危险的请求。从客户端检测到路径值:

我设置了一个值表,address列会将用户带到谷歌地图

<tbody>
    @foreach(var item in rowItems)
        {
            var addr = item.AddressDisplay;
            var url = "@http://maps.google.com/?q";
            //var addr = rawaddr.Replace(" ", "+");
            url = HttpUtility.UrlEncode(url + addr);

        <tr>
            <td class="tableCallAlighLeft">@item.EventDate.ToString("MM/dd/yyyy")</td>
            <td class="tableCallAlighLeft">@item.EventType</td>
            <td class="tableCellAlignLeft">@item.TimeStart.ToString("hh:mm tt")</td>
            <td class="tableCellAlignLeft">@item.TimeEnd.ToString("hh:mm tt")</td>
            <td class="tableCellAlignLeft">@item.VenueName</td>
            <td class="tableCellAlignLeft"><a href="@url">@item.AddressDisplay</a></td>
            <td class="tableCellAlignLeft">@item.CostMin.ToString("C")</td>
            <td class="tableCellAlignLeft">@item.CostMax.ToString("C")</td>
            <td class="tableCellAlignLeft">@item.Family</td>
            <td class="tableCellAlignLeft">@item.MinAge</td>
            <td class="tableCellAlignLeft">@item.Adult</td>
        </tr>
        } 
</tbody>
如何允许item.AddressDisplay转到Google地图

谢谢

我最后做了这样一件事:

<a href='@string.Format("http://maps.google.com?q={0}", addr)'>@item.AddressDisplay</a>

你知道谷歌地图,但不知道谷歌搜索我知道谷歌搜索,但我的印象是Stackoverflow是一个人们乐于互相帮助的网站。