• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Need a View to create a relative URL

I would like the current page to have an anchor tag that bring the user to the Home/Index View when clicked.

I think there are various ways to do this in MVC. I do not want clicking the URL to post back to a Controller Action, which I could then navigate to point at the Home/Index.  I would like to handle this on the client side.

Thanks.
0
newbieweb
Asked:
newbieweb
  • 2
2 Solutions
 
MrunalCommented:
Is there any specific reason of not using href attribute of anchor tag?
0
 
newbiewebAuthor Commented:
I was curius how to get a relative URL into an href.  The answer to my question was to use the following:

@Url.Content()

for the href:

<a href='@Url.Content("~/Home/Page2/")' title="See Page 2">Page2</a>
0
 
newbiewebAuthor Commented:
Thanks.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now