[HELP] Global.asax doen't execute OnBeginRequest

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fransis il Mulo

    [HELP] Global.asax doen't execute OnBeginRequest

    Yesterday I posted about Url-Rewriting. Now I have solved this kind of
    problem but now I have troubles deploying on Win2003 my application.

    I develop apps on VS 2005 and XP pro. To manage Url-Rewriting i insert
    code in the OnBeginRequest method in Global.asax. It works fine on dev
    machine but when I deploy on Win 2003 Server it doesn't work.

    Everytime my app fire the OnBeginRequest I also write a log row in a
    text file with requested Url. On Dev machine if I call test.aspx in log
    file i find many rows one for each file enclosed in web page (the page
    itself, css, images ...).

    On Win 2003 server in log file I find only one row , the page itself.
    No errors but also no url-rewritig.

    Can you help me?

    Thanks a lot.

    Fransis
  • Fransis il Mulo

    #2
    Re: [HELP] Global.asax doen't execute OnBeginRequest

    I try to explain better:

    I inserted this code in OnBeginRequest.


    if (!System.IO.Fil e.Exists(Reques t.PhysicalPath) )
    {
    Context.Rewrite Path("~/test.aspx", false);
    }


    Then on a web page (default.aspx) i've a link to url "NotExistingFil e.html".

    When I enter the default.aspx the code inside OnBeginRequest is
    executed. Instead, When I clik the link to NotExistingFile .html the code
    is not executed.

    This code works right on dev machine with (VS2005 and XP Pro) but not on
    Win 2003 Server.

    Can you help me?

    Thanks

    Fransis

    Comment

    • David

      #3
      Re: [HELP] Global.asax doen't execute OnBeginRequest

      If you change the link to NotExistingFile .aspx, then I would guess that it
      works.

      Basically, if you are trying to redirect a file that doesn't exist, then you
      have to ensure that the (non-existant) file you are linking to is being
      handled by .NET. In this case, .HTML is probably not being checked.

      So, basically, if you want .html to be used by .NET, then you have to set
      your mappings in IIS to cause .html to be handled.

      --
      Best regards,
      Dave Colliver.

      ~~
      http://www.FOCUSPortals.com - Local franchises available


      "Fransis il Mulo" <francogozzi@ti scali.itwrote in message
      news:47c46a7a$0 $37205$4fafbaef @reader3.news.t in.it...
      >I try to explain better:
      >
      I inserted this code in OnBeginRequest.
      >
      >
      if (!System.IO.Fil e.Exists(Reques t.PhysicalPath) )
      {
      Context.Rewrite Path("~/test.aspx", false);
      }
      >
      >
      Then on a web page (default.aspx) i've a link to url
      "NotExistingFil e.html".
      >
      When I enter the default.aspx the code inside OnBeginRequest is executed.
      Instead, When I clik the link to NotExistingFile .html the code is not
      executed.
      >
      This code works right on dev machine with (VS2005 and XP Pro) but not on
      Win 2003 Server.
      >
      Can you help me?
      >
      Thanks
      >
      Fransis

      Comment

      • Fransis il Mulo

        #4
        Re: [HELP] Global.asax doen't execute OnBeginRequest

        David ha scritto:
        If you change the link to NotExistingFile .aspx, then I would guess that it
        works.
        >
        Basically, if you are trying to redirect a file that doesn't exist, then you
        have to ensure that the (non-existant) file you are linking to is being
        handled by .NET. In this case, .HTML is probably not being checked.
        >
        So, basically, if you want .html to be used by .NET, then you have to set
        your mappings in IIS to cause .html to be handled.
        >
        Perfect, now it works!

        Thanks a lot

        Comment

        Working...