views:

259

answers:

1

i've been trying to get this to work. its basicly a way to have certain MVC pages work within a webforms cms (umbraco)

someone tried it before me and had issues with MVC2.0 (see here), i read the post, did what was announced there, but with or without that code, i seem to get stuck on a different matter.

it seems like, if i call an url, it fires the handler, but fails to request the querystring passed, the variable originalPath is always empty, for example i call this url: http://localhost:8080/mvc.ashx?mvcRoute=/home/RSVPForm the handler is supposed to get the mvcRoute but it is always empty. thus gets rewritten to a simple / and then returns resource cannot be found error.

here is the code i use now

public void ProcessRequest(HttpContext httpContext)
{
        string originalPath = httpContext.Request.Path;
        string newPath = httpContext.Request.QueryString["mvcRoute"];
        if (string.IsNullOrEmpty(newPath))
            newPath = "/";

        HttpContext.Current.RewritePath(newPath, false);
        IHttpHandler ih = (IHttpHandler)new MvcHttpHandler();
        ih.ProcessRequest(httpContext);
        HttpContext.Current.RewritePath(originalPath, false);
}

i would like some new input on this as i'm staring myself blind on such a simple issue, while i thought i would have more problems with mvc itself :p

+1  A: 

have no time to investigate, but after copying the site over to different locations, using numerous web.config changes (unrelated to this error but was figuring other things out) this error seems to have solved itself. so its no longer an issue, however i have no clue as to what exactly made this to work again.

on a side note

ih.ProcessRequest(httpContext);

should have been,

ih.ProcessRequest(HttpContext.Current);
Sander