Search code examples
iisasp.net-mvc-5publishing

How to publish my MVC5 Application into IIS with no error result


I already published my MVC5 Web application into IIS and my some view are working fine

enter image description here

but when i open my Contact List View i'm getting error and i also noticed that my default URL is localhost/TBSWeb/MainWeb/MainWeb but when I click Contact List Button TBSWeb has been removed anyone can give me some information about what is my mistake?

enter image description here


Solution

  • It seems that we lost the area property, please pay attention to the code snippets for redirection.
    Backend:
    return RedirectToAction("action", "controller", new { area = "area" });

    FrontEnd:

    Html.ActionLink("Link Text", "ActionName", "ControllerName", new { Area = "AreaName" }, new{})
    

    Alternatively, there are some routing errors during the redirection. Please refer to the below usage of the html helper.
    https://learn.microsoft.com/en-us/previous-versions/visualstudio/dn154285(v%3Dvs.118)

    Feel free to let me know if the problem still exists.