i trying turn button action link, link takes me page need send new { id = item.id }
other page , don't know how else this:
@foreach (var item in model.currentpost.tags) { <div class="col-lg-2"> <a href="@html.actionlink("" + item.name + "", "getpostsbytag", "post", new { id = item.id }, null)" class="btn btn-default btn-lg"> @item.name </a> </div> }
i getting error:
a potentially dangerous request.path value detected client (<).
when clicking button url tried take me was:
http://localhost:52202/post/maindetails/<a href="/post/getpostsbytag?id=54">picture</a>
have no idea why picture appended on end or href, should be:
http://localhost:52202/post/maindetails/getpostsbytag?id=54
@html
used generate html, matching methods in @url
(like urlhelper.action
) should used generates urls href
attribute.
so fix problem either use @url.action
if need detailed control on resulting html
<a href='@url.action("" + item.name, "getpostsbytag", "post", new { id = item.id }, null)' class="btn btn-default btn-lg"> @item.name </a>
or use @html.actionlink
generate whole <a>
tag:
@html.actionlink(item.name, "getpostsbytag", "post", new { id = item.id }, new {class="btn btn-default btn-lg"})