tags:

views:

217

answers:

2

I have started a new mvc project and clicked on project\properties\web - use local IIS server (mine is 5.1). I've created a virtual directory all ok.

When I run I get a 403 error - in url http://localhost/myProjectName/

I have set IIS to windows integrated security and set web.config to windows.

My ultimate goal is to use mixed windows and forms authentication for an intranet app.

I appreciate any help.

A: 

I don't believe this will work off the bat for IIS 5.1. By default, MVC controllers/pages don't have extensions, and so IIS doesn't know who to forward the request to during the request pipeline.

In IIS 6.0, you can set a IIS wildcard mapping forward all unknown files to the ASP.NET engine. For 5.1, you'll probably have to configure MapRoutes so that your urls include the mvc extension:

http://localhost/myproject/home.mvc
David Andres
Thanks - I changed the routing in mvc to look for that - how do I do configure IIS?
Davy
Within the Virtual Directory tab of the properties for the site, click on the Configuration button.In Application Mappings, click the Add button. Locate the aspnet_isapi.dll in \Windows\Microsoft.Net\Framework\v2.0.50727. Just make sure All Verbs is selected but that Check that file exists is not.
David Andres
Davy, have you had any success with this approach?
David Andres
I can get the app to load but as soon as i click on another action it just reloads that page and drops all styling.
Davy
Check the links on the page, and ensure that they're going where you expect them to (e.g, they have the mvc extension). Are you using Html.Action?
David Andres
Sorry should add - http://localhost/myProject/ is fine.if I change my route code to:routes.MapRoute( "Default", "default.aspx/{controller}.mvc/{action}/{id}", new { action = "Index", id = "" } );This is based on what I read here: http://www.asp.net/LEARN/mvc/tutorial-08-cs.aspxNow - http://localhost/FirstMVC/default.aspx/Order.mvc returnsthe output from http://localhost/myProject but with no styling.
Davy
Should your URL be localhost/myProject/Order.mvc instead of localhost/FirstMVC/default.aspx/Order.mvc?
David Andres
sorry typo - It's working now. I'm not sure exactly what I had done wrong but the advice here was sound - thanks.Now I have - http://localhost/myProject/Home.mvc/About etc working with route code.routes.MapRoute( "Default", "{controller}.mvc/{action}/{id}", new { action = "Index", id = "" } );So in conclusion - Add .mv mapping extention and change routing as above.Thanks again.Davy
Davy
Ok, going forward: IIS 5.1 needs some extension to help the service route requestsIIS 6.0 needs either an extension or wildcard mappingIIS 7.0 handles MVC requests out-of-the-boxGlad to hear all of this helped.
David Andres
A: 

It can work. Solution is not elegant but it does exist. Take a look at my article IIS vs. ASP.NET URL Rewriting

Alex Ilyin