ASP.net MVC Routing problem - asp.net

I have deployed my ASP.net MVC site to a shared hosting company. The problem is that now none of the pages except for the home page work. For example if I go to /Account/Register I get a page not found. However, if I go to /Account/Register/Index.aspx then it does work. I have tried modifying the routing to add in that index.aspx but everything I have tried fails.

Sounds like you need to either
1) have a wildcard mapping set up in IIS (don't know if thats an option)
2) or setup the routes to include the extension ("{controller}.mvc/{action}/{id}").
Either way have a look at this post by Phil Haack: ASP.NET MVC on IIS 6 Walkthrough

Related

Using a view specific connection string in ASP.NET MVC

I upgraded an old website from ASP.NET to MVC recently and now I am running into a user login problem with one of my views. In the old situation I would have a separate web.config in the folder for that page that would set the connection string specifically for that page. Now I would like to do that in ASP.NET MVC as well, however the web.config in the specific views folder does not work. I also tried to change the web.config in the views folder, but maybe I did this in a wrong way because it did not work.
Does anyone have an idea how to accomplish the same result in ASP.NET MVC as I had in ASP.NET?
Why not use a separate configuration file, as explained in this MSDN article?
https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/connection-strings-and-configuration-files

Asp.net url routing in application having more than one page

I am using URL routing to make links to users profiles in asp.net, its work but the rest pages of the application not work , did i have to define a route for all pages or i miss something in somewhere.
I don't work with asp.net mvc but with asp.net web forms.
For profile page i want the routing but there is pages i just wont to use a asp x link to it
but all the pages now have the same URL defined in the routes in the global file.
I write this problem before two days always i have a problem.
You can debug your routes with ASP.NET MVC Routing Debugger Visualizer
or take a look at the blog of Phil Haack

asp.net MVC Routing Problem

Someone has asked me to look at their code to do a few little changes to the processing, but before I can get anywhere, I can't even run up the main page. It seems to be MVC, seems to have the right routes etc. It defaults to a ~/home from default.aspx and there seems to be a route in place, but I get a 404.
I've tried changing the route and it still fails. I've debugged and it seems to be setting the routes up. I've set up Phil Haack's debug utility but it still just gives me a 404.
I'm quite new to asp.net MVC, but I've done asp.net and know some MVC (CakePHP) and I'm not really working with the MVC, just some processing code. Are there any big "gotchas" I should be looking for?
There is a Default.ASPX page that is included in the root path by default in all ASP.NET MVC projects. It has a comment in it that says:
Please do not delete this file. It is
used to ensure that ASP.NET MVC is
activated by IIS when a user makes a
"/" request to the server.
You might want to check and see if it is still there.
Are you running the app on IIS 6? If so, the problem is that IIS only invokes ASP.NET when it sees a .aspx extension in the URL. This can be fixed in a number of ways, described, for instance, here and here. I solved the problem changing IIS options to use aspnet_isapi.dll for all files (that is, *).
The problem was that the project was built on asp.net MVC Preview, and I already had asp.net MVC v1 installed, which seemed to create some sort of conflict.
I've removed asp.net MVC and the problem has gone away.

IIS 5 & ASP.NET MVC Directory Browsing Problem

We configured IIS 5 by mappping * to asp.net handler so that ASP.NET MVC works. After configuring this, directory browsing is not working.
Also uploadify jquery plugin is not working. Showing IO error 2038.
Can someone please suggest us how to enable directory browsig with ASP.NET MVC configurations on IIS 5?
I don't think that you'll be able to get directory browsing to work with ASP.NET MVC in the same application. When you added the wildcard mapping, you told ASP to handle every request. If the request doesn't map to an actual file, it will try to match a route in MVC. If there isn't a matching controller with an index (assuming that's your default) action, then it will fail.
My suggestion is to split your web site into "application" and "content". Set up the application as a separate web site and apply the wildcard mapping there. Leave your content with the original configuration. I don't use IIS5 any more -- with one exception on an old XP development box -- I'm afraid that can't really be of more help.
If I were you, though, I'd upgrade to a more recent OS and web server. Expecting new technology to work on a decade-old platform is very optimistic.

ASP.NET Routing not firing when site is published to remote host

I have a website that was originally written in webforms to which I have added MVC functionality. When debugging locally it works fine, however, once published and uploaded to my host the routes do not work and return a 404.
I am pretty sure that I have uploaded all the correct files. Would just appear that routing is not working.
Any idea?!
(the site will still serve normal aspx pages fine)
I think the problem may be related to Mixing ASP.NET MVC into ASP.NET WebForms
But I cant see from that thread what the solution was. It looks like it might be something to do with the app_pool mode - but I am running in integrated mode, which is right AFAIK
UPDATE 2
So I think I have routing working. I basically created a new MVC app and went through theweb config file line by line and made sure I have everything I needed. Funnily, none of the tutorials online mention the correct additions you need to make. hey ho..
I have have another issue mind you...
When i load my mvc page I am greeted with the message:
The SessionStateTempDataProvider requires SessionState to be enabled.
I've added a line to web.config to enable sessions (wasn't aware they were off) and it still doesnt work.
UPDATE
I created a new asp.net MVC project and ended up going through web.config line by line and ensuring that everything that related to MVC was included in my hybrid app. Suffice to say that none of the guides mention all the settings that are required (i was using the book professional asp.net mvc 1.0). I then included the global.asax file which is not published and set up a route so that a request for / was not being caught by MVC. I also had to enable sessions in web.config.
And now it works!
Should I mark this question as the answer...not sure on the protocol here :)
I was going through the same thing because I deploy with compiled views. I don't know why but global.asax isn't included in the Release folder that I uploaded. I just figured it was compiled into one of the DLLs. I was getting 404 for everything so I tried uploading global.asax and the site came to life.

Resources