Adding a new View and providing a link to it

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
Ok I have created a folder under Views folder called "Terms" and in that folder I created a Index.cshtml file

In the Footer.cshtml file I placed this code in

<a href="@Url.RouteUrl("Terms")">Terms of use</a>


I also created a Controller and  placed the following code

using System.Web.Mvc;

namespace Nop.Web.Controllers
{
    public class TermsController : BaseNopController
    {
        public ActionResult Index()
        {
            return View();
        }
    }
}


Problem is is that now the site won't even load So what is it that I am doing wrong or forgetting.

If I remove the
<a href="@Url.RouteUrl("Terms")">Terms of use</a>


Than the site will load but obviously there is no link to the Terms of use at that point.
12 年 前
I presume you haven't defined "Terms" route. Routes are defined in the \Presentation\Nop.Web\Infrastructure\RouteProvider.cs file
12 年 前
Thank you I did not see where it was that they had the Routes defined.
I did what you suggested and the error has gone away but I still have an issue with it.
Here is my Route


routes.MapLocalizedRoute("TermsPage",
                            "",
                            new { controller = "Terms", action = "Index" },
                            new[] { "Nop.Web.Controllers" });


The problem I have is this Route just points back to the root directory or otherwise known as the homepage
12 年 前
I just answered the last part of that question myself.




routes.MapLocalizedRoute("TermsPage",
                            "terms",
                            new { controller = "Terms", action = "Index" },
                            new[] { "Nop.Web.Controllers" });


Thank you so much for the info you provided
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.