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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. 403(The website declined to show this webpage) Error - WebConfig Authorization - Need to redirect to login

403(The website declined to show this webpage) Error - WebConfig Authorization - Need to redirect to login

Scheduled Pinned Locked Moved ASP.NET
securitydatabasecomhelpquestion
5 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.
  • D Offline
    D Offline
    De_Novice
    wrote on last edited by
    #1

    Hi, I have created a sample login site using SQL membership provider and authentication and authorization. The admin folder has a default.aspx and in the web config I have denied access to users who are not of role admin and any other user. When I run the code with the admin/default.aspx as start page locally, it works fine by redirecting me to login page. However on publish when I type in www.domainname.com/admin/default.aspx, I get the error that "The website declined to show this webpage, Most likely causes:This website requires you to log in.". How can I make it redirect to login page. Thanks

    N D 2 Replies Last reply
    0
    • D De_Novice

      Hi, I have created a sample login site using SQL membership provider and authentication and authorization. The admin folder has a default.aspx and in the web config I have denied access to users who are not of role admin and any other user. When I run the code with the admin/default.aspx as start page locally, it works fine by redirecting me to login page. However on publish when I type in www.domainname.com/admin/default.aspx, I get the error that "The website declined to show this webpage, Most likely causes:This website requires you to log in.". How can I make it redirect to login page. Thanks

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      What settings have you applied to the web.config in your production environment?


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • D De_Novice

        Hi, I have created a sample login site using SQL membership provider and authentication and authorization. The admin folder has a default.aspx and in the web config I have denied access to users who are not of role admin and any other user. When I run the code with the admin/default.aspx as start page locally, it works fine by redirecting me to login page. However on publish when I type in www.domainname.com/admin/default.aspx, I get the error that "The website declined to show this webpage, Most likely causes:This website requires you to log in.". How can I make it redirect to login page. Thanks

        D Offline
        D Offline
        De_Novice
        wrote on last edited by
        #3

        Here is a part of the web config file from the production:

        <authentication mode="Forms" >
        <forms loginUrl="login.aspx" >
        </forms>
        </authentication>

              <authorization>
            <allow roles="Admin, Employee"/> 
            <deny users="\*"/>
          </authorization>
        
        </system.web>
        
        
              <location path="Admin">
          <system.web>
            <authorization>
              <allow roles="Admin"/>
              <deny roles="Employee"/>
              <deny users="\*"/>
            </authorization>
          </system.web>
        </location>
        

        Why does it work in development and not when published. I havent changed any settings from development to publish accept the database connection string.

        D 1 Reply Last reply
        0
        • D De_Novice

          Here is a part of the web config file from the production:

          <authentication mode="Forms" >
          <forms loginUrl="login.aspx" >
          </forms>
          </authentication>

                <authorization>
              <allow roles="Admin, Employee"/> 
              <deny users="\*"/>
            </authorization>
          
          </system.web>
          
          
                <location path="Admin">
            <system.web>
              <authorization>
                <allow roles="Admin"/>
                <deny roles="Employee"/>
                <deny users="\*"/>
              </authorization>
            </system.web>
          </location>
          

          Why does it work in development and not when published. I havent changed any settings from development to publish accept the database connection string.

          D Offline
          D Offline
          De_Novice
          wrote on last edited by
          #4

          ok.. I changed the setting for the admin folder from deny users "*" to deny users"?" and it worked.

          <location path="Admin">
          <system.web>
          <authorization>
          <allow roles="Admin"/>
          <deny roles="Employee"/>
          <deny users="?"/>
          </authorization>
          </system.web>

          what is the difference between * and ?.

          N 1 Reply Last reply
          0
          • D De_Novice

            ok.. I changed the setting for the admin folder from deny users "*" to deny users"?" and it worked.

            <location path="Admin">
            <system.web>
            <authorization>
            <allow roles="Admin"/>
            <deny roles="Employee"/>
            <deny users="?"/>
            </authorization>
            </system.web>

            what is the difference between * and ?.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Reading the documentation helps to answer questions like this. * means all, ? means only authenticated


            I know the language. I've read a book. - _Madmatt

            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