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. Webconfig customerror

Webconfig customerror

Scheduled Pinned Locked Moved ASP.NET
helpphp
6 Posts 3 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.
  • J Offline
    J Offline
    jithbiz0033
    wrote on last edited by
    #1

    Hi Guys, I using the followiing code in my Web.config file <customErrors mode="RemoteOnly" defaultRedirect="default.aspx"> <error statusCode="404" redirect="default.aspx"/> </customErrors> My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page. It shows the error page of the Browser. HTTP Error 404 -File or directory not found. I want to redirect it to my default page. If anybody has suggestions or coding .Please reply. Thanks Jith -- modified at 3:04 Friday 18th May, 2007

    S N 3 Replies Last reply
    0
    • J jithbiz0033

      Hi Guys, I using the followiing code in my Web.config file <customErrors mode="RemoteOnly" defaultRedirect="default.aspx"> <error statusCode="404" redirect="default.aspx"/> </customErrors> My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page. It shows the error page of the Browser. HTTP Error 404 -File or directory not found. I want to redirect it to my default page. If anybody has suggestions or coding .Please reply. Thanks Jith -- modified at 3:04 Friday 18th May, 2007

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      jithbiz0033 wrote:

      My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page.

      because For instance, if you define a custom error for the status code 404, ASP.NET will issue it anytime you refer to a non-existing .aspx page The custom errors are only issued for those elements handled by ASP.NET. For instance, if you refer to a non-existing .htm page, IIS issues the standard 404 error Taken from MSDN

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      J 1 Reply Last reply
      0
      • J jithbiz0033

        Hi Guys, I using the followiing code in my Web.config file <customErrors mode="RemoteOnly" defaultRedirect="default.aspx"> <error statusCode="404" redirect="default.aspx"/> </customErrors> My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page. It shows the error page of the Browser. HTTP Error 404 -File or directory not found. I want to redirect it to my default page. If anybody has suggestions or coding .Please reply. Thanks Jith -- modified at 3:04 Friday 18th May, 2007

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #3

        jithbiz0033 wrote:

        mode="RemoteOnly

        try with mode="On" Might be you are trying at the local host.

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        1 Reply Last reply
        0
        • J jithbiz0033

          Hi Guys, I using the followiing code in my Web.config file <customErrors mode="RemoteOnly" defaultRedirect="default.aspx"> <error statusCode="404" redirect="default.aspx"/> </customErrors> My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page. It shows the error page of the Browser. HTTP Error 404 -File or directory not found. I want to redirect it to my default page. If anybody has suggestions or coding .Please reply. Thanks Jith -- modified at 3:04 Friday 18th May, 2007

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

          jithbiz0033 wrote:

          My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page.

          This is Because web.config is not having any role in serving HTML or PHP pages. Webserver will be doing this job. Web.Config will be working only with the extensions mapped with aspnet_isapi.dll. You can redirect HTML or PHP file by changing the default 404 error message in IIS.

          Navaneeth My Website

          J 1 Reply Last reply
          0
          • S Sandeep Akhare

            jithbiz0033 wrote:

            My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page.

            because For instance, if you define a custom error for the status code 404, ASP.NET will issue it anytime you refer to a non-existing .aspx page The custom errors are only issued for those elements handled by ASP.NET. For instance, if you refer to a non-existing .htm page, IIS issues the standard 404 error Taken from MSDN

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            J Offline
            J Offline
            jithbiz0033
            wrote on last edited by
            #5

            Hi, Is there any way that I could redirect the other extensions to my default page? Thanks, Jith

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

              jithbiz0033 wrote:

              My problem is if give an file name with extensions(like .htm,.php,.asp etc) other than .aspx the page is not redirecting to the default page.

              This is Because web.config is not having any role in serving HTML or PHP pages. Webserver will be doing this job. Web.Config will be working only with the extensions mapped with aspnet_isapi.dll. You can redirect HTML or PHP file by changing the default 404 error message in IIS.

              Navaneeth My Website

              J Offline
              J Offline
              jithbiz0033
              wrote on last edited by
              #6

              Hi, How can I redirect other extensions files ? to my default page Thanks Jith

              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