Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:39:03+00:00 2026-06-10T15:39:03+00:00

I have followed the tutorials over at MSDN and they all (from what I’ve

  • 0

I have followed the tutorials over at MSDN and they all (from what I’ve seen) seem to use @Href() for URL’s. E.g.

<a href="@Href("~/")">Some link</a> but I remember reading on here months ago that it is more secure to use Server.MapPath(), E.g.

<a href="@Server.MapPath("~/")">Some link</a> since it converts it to a full path, meaning that you cannot edit the underlying code to change where the form gets submitted to (or something like that). Is this true?

Should I use Href() or Server.MapPath()? Which one is better, and why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:39:04+00:00Added an answer on June 10, 2026 at 3:39 pm

    More secure? I don’t see a reason why – but I would use neither in Razor. Here’s why:

    As far as I remember, the Href function is from the ASP.NET 1.0 times. When doing WebForms (!) code you can just paste the ~-URL <a href="~/" runat="server">Some link</a>.

    However, if you’re doing ASP.NET MVC (which I assume you’re doing since you’re using Razor) you should rather use Url.Content() which fits with Url.Action() name-wise.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed some tutorials on how to create custem event accessors. This is
I am new to rails so could use some help here. I have followed
I have followed some tutorials on setting up a WCF web service with security
I am trying to jump from ASP Classic to asp.net. I have followed tutorials
I have just completed the tryruby.org tutorial, followed by the rubyforzombies.org tutorials and all
Basically, I have correctly followed different tutorials. Now, my models are taken from a
I need to include JSON in my android app, I have followed some tutorials
Hi have followed this tutorial using Core plot framework http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application My project compiles, but
I have followed his popular tutorial to connect Android to MySQL: http://www.helloandroid.com/tutorials/connecting-mysql-database It is
I have followed a tutorial on how to use the youtube gdata. Populating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.