Menu

#48 Url rewriting and Anthem.NET

open
nobody
None
5
2006-09-13
2006-09-13
Anonymous
No

I use url rewriting, so Anthem.NET uses incorrectly
url to send requests. Is it possible to change
javascript or c# code to fix this issue?

Discussion

  • Andy Miller

    Andy Miller - 2006-09-13

    Logged In: YES
    user_id=1245761

    I'm going to move this to Feature Requests.

    If you can, please add a bit more description of what you
    want. Especially talk about the kind of URL rewriting you
    are doing, how Anthem behaves now, and how you want Anthem
    to behave.

     
  • Andy Miller

    Andy Miller - 2006-09-13

    Logged In: YES
    user_id=1245761

    What is doing the rewriting? An ISAPI module or an ASP.NET
    module?

    If you set a breakpoint in your page, does the Request
    object show the rewritten URL or the original URL?

    If you put a normal ASP.NET control such as a LinkButton
    on the page that causes a PostBack, does it PostBack to
    http://localhost/OpenModel/Discussions/forum/ShowForm.aspx?
    If not, why not? Perhaps we can use the same technique in
    Anthem.

     
  • Vadim

    Vadim - 2006-09-14

    Logged In: YES
    user_id=1597519

    It is an ASP.NET module (HttpModule). I have a LinkButton on
    my page with url
    http://localhost/OpenModel/Discussions/forum/1.aspx. When I
    click this button (make request to server), my UrlRewriter
    (HttModule) converts this url to real using regular
    expressions:
    http://localhost/OpenModel/Discussions/ShowForum.aspx?id=1.
    So the Request object shows the original url. But Anthem
    uses right part of this url - ShowForum.aspx?id=1 and left
    part of rewritten url showing in browser -
    http://localhost/OpenModel/Discussions/forum/.
    It renders into my form the following:
    <script type="text/javascript">
    //<![CDATA[
    var Anthem_DefaultURL =
    "ShowForum.aspx?id=1&Anthem_CallBack=true";
    var Anthem_FormID = "aspnetForm";
    //]]>
    </script>
    If Anthem_DefaultURL will be "1.aspx?&Anthem_CallBack=true"
    - it could be very helpful.

     
  • Andy Miller

    Andy Miller - 2006-09-14

    Logged In: YES
    user_id=1245761

    This will be very hard for me or anyone other than you to
    implement. I don't have your URL rewriter, so I can't
    duplicate what you are seeing. Every time I think about
    it, I come up with about 10 details I would want to know.
    You may need to solve this one yourself.

    If you need help, at a minimum I would need your URL
    rewriter module and your regular expression.

     
  • Vadim

    Vadim - 2006-09-14

    Logged In: YES
    user_id=1597519

    If I comment in function GetPageURL(HttpContext context) in
    Manager.cs the following block of code:
    if (Anthem.Manager.BaseHref.Length == 0)
    {
    url = filePath;
    int lastSlash = url.LastIndexOf('/');
    if (lastSlash != -1)
    {
    url = url.Substring(lastSlash + 1);
    }
    }

    everything works fine.
    Why parses function GetPageURL the url in this way?

     
  • Andy Miller

    Andy Miller - 2006-09-14

    Logged In: YES
    user_id=1245761

    I honestly do not remember. If this code was added after
    this SourceForge project was started then you may be able
    to find the comments associated with the check-in by
    searching the developer list archives.

     
  • Vadim

    Vadim - 2006-09-14

    Logged In: YES
    user_id=1597519

    Ok, thanks for your help.
    I will set Anthem.Manager.BaseHref to any string value to
    skip the url parsing in GetPageURL function!

     

Log in to post a comment.