views:

555

answers:

2

Okay, I have read many of the routing posts concerning putting asp.net mvc on godaddy. However, I have not come to a solution to my current problem. I am trying to publish an ASP.NET MVC application to a subfolder on godaddy. I have upgraded the account to use IIS 7 and I have included the MVC dlls in \bin\ deployment method. However, I suspect that my route is not correct.

Currently, my routes are set up with the standard out of the box route:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "Default",                                              // Route name
        "{controller}/{action}/{id}",                           // URL with parameters
        new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
    );

}

I have a subdomain set up so that it looks like office.domain.com. The subdomain is pointing at a folder "/office/" which is right off the root folder. (There is not an MVC application installed in the root folder). All of my application has been placed in this 'office' folder. When I hover over the links however, the 'office' portion shows up in the link as well. e.g. Hovering over a link to the customer controller, index action yields "office.domain.com/office/Customer" as the target. This link then gets a 404 when I attempt to go to it.

What should my route be to fix this? Is there something I have neglected in setting up the subdomain in godaddy? Is this something I just can't do in godaddy's domain management "tool". Do I need to set up a virtual directory for this instead of just a directory?

Update: I changed the IIS settings in godaddy to use integrated pipeline mode, per this discussion and I am no longer getting 404 errors. The application worked just fine as suggested it would.

+2  A: 

If your application root is /office, then your routes need not worry about that.

If your application root is /, then you should setup routing for /office and setup an ignored route for everything else.

Wyatt Barnett
If you get a chance, can you be more explicit about what that looks like? I don't think I understand routes exactly. I have noticed that for some reason all links will prefix with something like 'office/Customer/', if that helps.
Anthony Potts
Hmm, perhaps you can edit your question with both what you are declaring for routes and how the urls look. From what you are saying, I think you fall under the first case--everything is running our of the /office application and ASPNETMVC don't care about the parent app.
Wyatt Barnett
A: 

hi Anthony,

I have the same requirement.

1) I have developed a MVC 2 demo website I followed the instructions of making sure the MVC DLLs are setup as "Copy Local"= true 2) Deployed them in local folder 3) Create a virtual directory in Go Daddy. 4) Ftp the files into the virtual directory Note: no web.config in my root directory 5) Access the /{folder}/Home/Index

and it does not work..!!!! I have to access the page as /{folder}/Home.aspx/Index

Does that mean that I have to create a sub domain to get MVC 2 working on sub folder? Is yours really working now? Did you do anything special on your routings?

I really appreciate if you can point me to the right direction

Thank you kindly. Cheers P/S I am happy to post this as a separate question instead of tagging to your existing question.

Syd
I have finally got it working. I was facing with several issues including (Medium Level) trusted code. I found the best way is to confirm locally by setting the following in my web.config <trust level="Medium"/>(*1 : don't forget to remove this before deploying to Godaddy) and I do NOT have to set the following "{controller}.aspx/{action}/{id}", in my routing as suggested by some previous posts. <br/>The following were tested and it works: /{folder}/Home/Index, /{folder}/Home/About, /{folder}/Admin, and RedirectToAction to another controller
Syd