iis 6 - MVC on IIS6 - 'Home' links not working correctly -


I am deploying a MCV 1.0 project on a web server running IIS6. (I do not like) I have done through the article of Steve Sanderson's article and Phil Hack, but I still have problems.

Right now I am trying to apply option 2 to the Steve Sanderson article . The main problem that I'm facing is with a home link that is not rendering correctly. For example, I have a follow-up in my site map:

  & lt;% = html.ActionLink ( "Home", "Index", "Home")% & gt;  

It presents on pages as http: //servername/JCIMS_Orange/Home.mvc which is not correct.

But this link:

  & lt;% = html.ActionLink ("About", "About", "Home")%>  

presents ... http: //servername/JCIMS_Orange/Home.mvc/About which is correct

My Global.asax register looks like the Routes function:

  Public static zero register routs {routes.IgnoreRoute ("{resource} .axd / {* pathInfo}"); New {controller = "home", action = "index", id = "" with the URL parameter ("default", // root name "{controller} .apx / {action} / {id}", // URL parameter. } // parameter defaults); New {controller = "home", action = "index", id = ""} with routes ("default 2", // root name "{controller} / {action} / {id}", // URL parameter // parameter defaults); }  

Can anyone tell me why my Home link will not render correctly? I have repeated this error running on WinXP on my local host and running Win2003 server on my web server.

Appreciate any suggestions or hints

why http: / Not correct /servername/JCIMS_Orange/Home.mvc ?

Edit: The parameters in your root definition tell the default system that the index is not required in the path. You can try to set the action parameter default to just the empty string. The generated URL should be forced to include the action name for index action through the Html.ActionLink . URL

  routes.MapRoute ("Default", // root name "{controller} .mvc / {action} / {id}", // with new parameters {home} ", Action =" ", id =" "} / / parameter defaults);  

However, I do not think this is the best solution. If your images and CSS are not working without the name of the name, it seems that you are not referencing the path correctly, can you provide an example of one of your image links and perhaps your CSS file link? Without seeing what they see, I can suggest that they should start with "/..

, you would like to fix those links so that when you are using a root URL The ID parameter that will work for that example (like http: //servername/JCIMS_Orange/Products.mvc/Details/5 )

Edit 2 : Because your site is included in a subfolder, you include that subfolder in your image and CSS path Starting a relative URL with "/" means that this server is right after the name. "../" means that it is relative to the current path, which you have seen with the default MVC routing. Because your URLs have different elements for different actions.

The subfolder path should work perfectly in every situation, like this:

  & lt; img src = "/ JCIMS_Orange / Content / Images / JCIMS_Banner.png" alt = "JCIMS B Ioner "/>  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -