Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sander Houttekier 114 posts 163 karma points
    Apr 26, 2010 @ 17:30
    Sander Houttekier
    0

    Umbraco httphandler not able to fetch querystring?

    I've been trying out posibilities for working with MVC and umbraco together,

    I tried to follow the guide by mark (http://memoryleak.me.uk/2009/04/umbraco-and-aspnet-mvc.html)

    But seemed unsuccesfull though i found out why in the comments,  it is not able to work with mvc 2.0

     

    that said, i wrote the handler differently, not an MvcHttpHandler but an IHttpHandler that delegates its ProcessRequest to the MvcHttpHandler.ProcessRequest().

    The problem with this handler is, that it is unable to get the querystring from the path, and maybe i'm staring at this too mutch, but it seems like something stupid i might have forgotten :)

    here you have the handler:

    public void ProcessRequest(HttpContext httpContext)

     

    {

     

     

     

    httpContext.Trace.Write("Mvc.ashx", "Begin ProcessRequest");

     

     

     

     

     

            string originalPath = httpContext.Request.Path;

     

     

     

     

     

     

     

            string newPath = httpContext.Request.QueryString["mvcRoute"];

     

     

     

     

     

     

     

     

     

            if (string.IsNullOrEmpty(newPath))

     

     

     

     

     

     

     

     

     

     

     

                newPath = "/";

     

     

     

     

     

     

     

     

     

     

     

     

     

            httpContext.Trace.Write("Mvc.ashx", "newPath = "+newPath );

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

            HttpContext.Current.RewritePath(newPath, false);

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

            IHttpHandler ih = (IHttpHandler)new MvcHttpHandler();

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    ih.ProcessRequest(httpContext);

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

            HttpContext.Current.RewritePath(originalPath, false);

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    }

     

     

     

     

     

     

     

     

     

     

     

     

     

    might anyone see my error, feel free to correct any of my mistakes.

     

  • Sander Houttekier 114 posts 163 karma points
    Apr 26, 2010 @ 17:34
    Sander Houttekier
    0

    auch, seems like something went wrong in rendering my code example, where do all those breaklines come from :)

     

    anyway, i forgot to say, what exactly went wrong,
    it does not error on anything, it just fetches the querystring and its empty every time
    even when i try this url for example: http://localhost:8080/mvc.ashx?mvcRoute=/home/RSVPForm

    querystring should have been /home/RSVPForm  but its empty
    so it tries to process the request and shows  resource not found error of course.

  • Sander Houttekier 114 posts 163 karma points
    Apr 28, 2010 @ 15:50
    Sander Houttekier
    0

    after alot more testing around with web.config and moving the site here and there, recreating things (to fix other issues) suddenly i noticed that this issue fixed itself.  If i have more time i will try to find out what changes i made and add them here but this issue is fixed so it seem.

Please Sign in or register to post replies

Write your reply to:

Draft