Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 17, 2012 06:46 AM by hiteshvyas
Dec 15, 2012 09:44 AM|LINK
what is the difference between @Url.Content() and @Href?
Dec 15, 2012 04:23 PM|LINK
Both are similar except Url.Content works with applications's virtual directory. @Href comes from System.Web.WebPages but @Url.Content is part of the MVC. The advise is to use @Url.Content due to its flexibility.
Dec 15, 2012 04:28 PM|LINK
They're quite similar, though Href comes from the ASP.NET WebPages stack. In an MVC context you should use Url.Content.
Dec 17, 2012 06:46 AM|LINK
They're quite similar, though
url.content does alot more than just creating an normal href, it takes into context the application's sub/virtual directory, whereas href it's a straight pointer.
for best practice use url.content, this way you know that if your site moves into a sub/virtual directory, your link will still work.