Codes with Hammer
Codes with Hammer

Reputation: 818

Linking from HTML page to MVC view

I have a legacy site that uses shtml pages. I have a project to add dynamic functionality to this site -- an MVC app where the user uploads files and the controller generates an email.

For legacy reasons, I am not able to rewrite the site. I also do not have web admin access to the site; I can only work with files in my area. The path I have to work with is //host/foo/bar/baz.

According to this Stack Overflow question, I ought to be able to make a link in the originating static page within the directory baz as <a href="Controller/Action">link text</a>. I tried that, and after fixing up issues with the app's web.config file, I got a 404 error. This does make sense now that I think about it, as there is no directory in baz called Controller -- only bin, Views, and the like. The physical path not found is foo/bar/baz/Controller/Action.

There are plenty of articles and Stack Overflow questions about adding a static page to an MVC app, but I have found nothing discussing the other direction.

How do I link from the static HTML page to the MVC action?

(I may have follow-on questions as I try to get the app to run.)

Edited to add: I tried moving the MVC app code to the top level of the web site (in my development environment). When I used the link this time, I encountered a configuration error in my IoC file, with mismatched versions of Entity Framework. This approach might be promising, and it also might encounter permissions issues in the operational environment.

Also, I do not have write permissions to the root level of the web server's documents area, only my subdirectory area.

Upvotes: 0

Views: 1964

Answers (1)

Vladyslav  Kurkotov
Vladyslav Kurkotov

Reputation: 505

<a href="/Controller/Action">link text</a> 

Try with "/" before controller

Upvotes: 2

Related Questions