I’m using Visual Studio 2008. I have created a project with asp.net Mvc 2 and C#. The project have a login page and followed by few pages. Its running correctly on my local machine. I’m publishing it on the server and when I click Login button it is not redirecting to next page and the url is not recognized.
The button url path is "/Data/Validatelogin/".I have tried IIS 6 and IIS 7.5. but no results.
here "data" is the "controller" and "Validatelogin" is a function. my view name is "Login". here the IIS confuses about the routing. after login i have redirected to ("Home","Index"). but it shows error on validation itself.
The browser error Shows : HTTP Error 404 - File or directory not found. The requested page "/Data/Validatelogin/" not found. Internet Information Services (IIS)
My guess is that you used Visual Studio’s web server to test directly (the default one). In this case, your application is hosted at the root of the web server, e.g. http://localhost:51234/Data/ValidateLogin.
You’ve now deployed your solution to IIS, and it’s probably sitting in http://someserver/someapplication/. When you redirect to “Data/ValidateLogin”, it goes to http://someserver/Data/ValidateLogin, instead of http://someserver/someapplication/Data/ValidateLogin.
Solution – try add “~/” to the start of the path when you redirect.