Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Url rewriting Error 404 page not found

Url rewriting Error 404 page not found

Scheduled Pinned Locked Moved ASP.NET
helpquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sepel
    wrote on last edited by
    #1

    Hi all. I have a simple urlrewriter. I want to rewrite some path such as mysite/Sale to a special page with parameter like mysite/Find.aspx?y=sale But when I rewrite HttpCuntex.Request to page find.aspx it raise an error:

    Error 404 page not found
    can not find mysite/sale/find.aspx?s...

    whats problem?

    sepel

    N 1 Reply Last reply
    0
    • S sepel

      Hi all. I have a simple urlrewriter. I want to rewrite some path such as mysite/Sale to a special page with parameter like mysite/Find.aspx?y=sale But when I rewrite HttpCuntex.Request to page find.aspx it raise an error:

      Error 404 page not found
      can not find mysite/sale/find.aspx?s...

      whats problem?

      sepel

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      sepel wrote:

      mysite/sale/find.aspx

      Is that file exist in mysite/sale path?

      Navaneeth How to use google | Ask smart questions

      S 1 Reply Last reply
      0
      • N N a v a n e e t h

        sepel wrote:

        mysite/sale/find.aspx

        Is that file exist in mysite/sale path?

        Navaneeth How to use google | Ask smart questions

        S Offline
        S Offline
        sepel
        wrote on last edited by
        #3

        Thanks for your rplay. No.The

        /sale

        path is virtual. I want to use some virtual path such as:ForRent,Sale,Apartemant..

        sepel

        N 1 Reply Last reply
        0
        • S sepel

          Thanks for your rplay. No.The

          /sale

          path is virtual. I want to use some virtual path such as:ForRent,Sale,Apartemant..

          sepel

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          The error message is straight forward. Well, where is this find.aspx resides? Can you show the code you used for rewriting?

          Navaneeth How to use google | Ask smart questions

          S 1 Reply Last reply
          0
          • N N a v a n e e t h

            The error message is straight forward. Well, where is this find.aspx resides? Can you show the code you used for rewriting?

            Navaneeth How to use google | Ask smart questions

            S Offline
            S Offline
            sepel
            wrote on last edited by
            #5

            public class SimpleRewriter : System.Web.IHttpModule
            {
            ..
            void context_BeginRequest(object sender, EventArgs e)
            {
            string newUrl = UrlEngine.Engine.ToRealUrl(_application.Context.Request);

               HttpContext.Current.RewritePath(newUrl, true);
            

            }
            }

            If _application.Context.Request be

            mySite/Sale

            newUrl get

            /Find.aspx?type=Sale

            value. Find.aspx is in Root Directory:mySite/Find.aspx

            sepel

            N 1 Reply Last reply
            0
            • S sepel

              public class SimpleRewriter : System.Web.IHttpModule
              {
              ..
              void context_BeginRequest(object sender, EventArgs e)
              {
              string newUrl = UrlEngine.Engine.ToRealUrl(_application.Context.Request);

                 HttpContext.Current.RewritePath(newUrl, true);
              

              }
              }

              If _application.Context.Request be

              mySite/Sale

              newUrl get

              /Find.aspx?type=Sale

              value. Find.aspx is in Root Directory:mySite/Find.aspx

              sepel

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              sepel wrote:

              HttpContext.Current.RewritePath(newUrl, true);

              A guess. Try passing false to RewritePath method?

              HttpContext.Current.RewritePath(newUrl, false);

              Navaneeth How to use google | Ask smart questions

              S 1 Reply Last reply
              0
              • N N a v a n e e t h

                sepel wrote:

                HttpContext.Current.RewritePath(newUrl, true);

                A guess. Try passing false to RewritePath method?

                HttpContext.Current.RewritePath(newUrl, false);

                Navaneeth How to use google | Ask smart questions

                S Offline
                S Offline
                sepel
                wrote on last edited by
                #7

                It rises error yet:

                Server Error in '/MySite' Application.

                The resource cannot be found.
                Description: HTTP 404. The resource you are looking for (or one of its dependencies)
                could have been removed, had its name changed, or is temporarily unavailable.
                Please review the following URL and make sure that it is spelled correctly.

                Requested URL: /MySite/Sale/find.aspx

                I think i must change /MySite/Sale/find.aspx to /MySite/find.aspx. It means i must rewrite Relative Path of httpCuntex.But I don't know how?

                sepel

                modified on Tuesday, January 13, 2009 4:54 AM

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups