-1

I have an MVC5 Application, published on remote server, that has the HomeController with About ActionResult method, i have the RouteConfig.cs configured as follows:

            routes.MapRoute("Default", 
            "{controller}/{action}", 
            new { controller = "Home", action = "Login"});

However, when i navigate to the publish URL as 192.xxx.1.xx/MyApp, the login form is openeed as expected, but after entering the userName and password and submitting form, where submit redirects to Post Method Login in HomeController with following code:

        [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Login(SSERPService.UserName userName)
    {
        return RedirectToAction("About");
    }

the URL changes to 192.xxx.1.xx/MyApp/Home/About, but the page displays "Nothing found" (The controller method "About" seems not to be hit), same behaviour happens when entering the URL to the About page manually as "192.xxx.1.xx/MyApp/Home/About" from the browser URL tab, where the page displays "Nothing found", However, when changing the RouteConfig "Default" as the code below:

            routes.MapRoute("Default", 
            "{controller}/{action}", 
            new { controller = "Home", action = "About"});

and then navigating to 192.xxx.1.xx/MyApp, then the "About" page gets displayed, and the URL in browser stays as 192.xxx.1.xx/MyApp,

How can i let the manually Entered URL in browser URL tab and the RedirectToAction display the intended page "About"?

Note: the published version on the local machine doesn't cause this problem, only the hosted version on remote server

Please Advise,

Thanks in advance,

Yazan
  • 179
  • 2
  • 4
  • 10
  • could you please share how you hosted the web application in iis as a web site/ application or virtual directory? do you have any URL rewrite setting or special MVC route setting? you could try to run the frt in iis. https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis – Jalpa Panchal Apr 01 '20 at 06:57
  • Please include your `About` action code. – swinn Nov 23 '22 at 18:28

1 Answers1

0

Have you tried specifying more the redirect, something like:

return RedirectToAction("About", "Home");

I can't comment yet so I have to post as answer instead

setemalky
  • 31
  • 5