0

I put an html anchor link in one of my Views. Just like this:

<a href="SomePage.html"> Some Link<a>

It does not go to the page. I suppose it is because it does not have a Controller and is not wired up with MapRoute.

My question is: Can I use a regular html anchor tab in an MVC application or Must I wire it up with the MVC Controller and MapRoute?

2 Answers 2

2

This is because an HTML file in a view folder doesn't automatically have an action associated with it. Remember, with MVC, views are just something that is rendered by a controller that is serving a route. The views folder is just a handy place to store these views, and doesn't map to any actual URL's unless there is a route specified.

The general convention is to put these kinds of files in the Static or Content folder, where they will be served up just fine.

Sign up to request clarification or add additional context in comments.

Comments

0

You should be able to. Is the path correct? What page is it on? Are you going up the path tree?

1 Comment

If I put the page in /View/Home/SomePage.htm then it does not work. If I put SomePage.htm in the root of the application, it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.