0

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)

Adam Wagner
  • 15,469
  • 7
  • 52
  • 66
ganesh
  • 859
  • 6
  • 13
  • 29

2 Answers2

1

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.

Daniel B
  • 2,877
  • 18
  • 18
  • You're welcome, and I should probably mention that this needs to be done across the board for all content too (images, CSS files, JS files, etc). – Daniel B Aug 24 '11 at 07:53
  • I have created a project with good slideshow's and menu. it works fine in local machine. but when i publish and look in server jquery not working.. please help.. im very confused. css working fine dude.. – ganesh Aug 25 '11 at 07:46
  • You haven't given enough info for me to guess at what's wrong. I suspect it's not finding the JQuery files due to the same problem you had with the redirect. To troubleshoot these types of problems, you should get familiar with FireBug (a very good HTML / JS / CSS debug tool usually used with FireFox). Under FireBug's Net tab, you will see all the items it's trying to fetch from your server. Things that fail will be in red. If it's not finding your JQuery files, you will immediately see it. Try this please, it's useful for all web developers. – Daniel B Aug 25 '11 at 07:56
  • dude i solved the problem..i placed the script tag outside the form tag.. now it replaced inside the form tag............ – ganesh Aug 25 '11 at 08:03
0

Try these:

Can't run ASP.NET MVC 2 web app on IIS 7.5

or on iis6

http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

Community
  • 1
  • 1
Lasse Edsvik
  • 9,070
  • 16
  • 73
  • 109
  • thanks for your post.. I have tried these links too. but getting same error please give some other solution.... – ganesh Aug 24 '11 at 06:39