forms auth, masterpages, login ctrl not working as expected?

Last post 04-17-2007 5:09 PM by cholwerda. 2 replies.

Sort Posts:

  • forms auth, masterpages, login ctrl not working as expected?

    04-10-2007, 1:22 PM
    • Member
      point Member
    • cholwerda
    • Member since 12-06-2006, 10:25 AM
    • Posts 5

    I have a site that has a home master page.  In this masterpage, is a login control and various other hyperlinks to all guest content (about us, contact us, etc).  I'm using Forms authentication.

    How do I setup the config so that the home page general info links are accessible via all, yet if the user supplies a username/password they are sent to the "protected" area.  I'm try the location tags as that seems like it should be what to do.  The first location is for the general info, the 2nd location is supposed to be for if the user fires off the login control.  It keeps wanting to go to default.aspx (doesn't exist) which seems like it is firing the event in the 1st location..not the 2nd.  I'm sure I'm doing something wrong, but if someone has any ideas that'd be great.

    Thanks 

     

    Here is my config...

    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
        <connectionStrings/>
     
        <location path="">
            <system.web>
                <authentication mode="None"/>
            </system.web>
        </location>
     
        <location path="~/protected">
            <system.web>
                <compilation debug="true" strict="false" explicit="true"/>
                <pages>
                    <namespaces>
                        <clear/>
                        <add namespace="System"/>
                        <add namespace="System.Collections"/>
                        <add namespace="System.Collections.Specialized"/>
                        <add namespace="System.Configuration"/>
                        <add namespace="System.Text"/>
                        <add namespace="System.Text.RegularExpressions"/>
                        <add namespace="System.Web"/>
                        <add namespace="System.Web.Caching"/>
                        <add namespace="System.Web.SessionState"/>
                        <add namespace="System.Web.Security"/>
                        <add namespace="System.Web.Profile"/>
                        <add namespace="System.Web.UI"/>
                        <add namespace="System.Web.UI.WebControls"/>
                        <add namespace="System.Web.UI.WebControls.WebParts"/>
                        <add namespace="System.Web.UI.HtmlControls"/>
                    </namespaces>
                </pages>
                <authentication mode="Forms">
                    <forms name="OurCookie" loginUrl="Default2.aspx" defaultUrl="~/protected/SecuredHome.aspx"/>
                </authentication>
                <authorization>
                    <deny users="?"/>
                </authorization>
            </system.web>
        </location>
     
        <system.web>
            <compilation debug="true"/>
      </system.web>
    </configuration>

     

  • Re: forms auth, masterpages, login ctrl not working as expected?

    04-11-2007, 5:23 PM
    • Member
      291 point Member
    • deepak11
    • Member since 02-03-2006, 5:12 PM
    • Posts 51
    Dont put your login control on the Masterpage... instead put a link to your login page on the masterpage and leave your other general links on the master. You might want to use the Membership Provider and Role provider for allowing/denying pages to the users based on their credentials.
    Deepak Sharma
    |My website|
    Please “mark as answer” if this answers your question. Thanks.
  • Re: forms auth, masterpages, login ctrl not working as expected?

    04-17-2007, 5:09 PM
    • Member
      point Member
    • cholwerda
    • Member since 12-06-2006, 10:25 AM
    • Posts 5

    Thanks for the response. 

    The business requirements state to have the login on the initial home page.  Any other ideas on how I can get it to work or is it impossible?  We are implementing a custom membership provider to access user/password tables.

Page 1 of 1 (3 items)