Form Authentication not working in hosting server

Discussion in 'ASP.NET 2.0' started by santhakumard, Aug 31, 2009.

  1. Hi

    I have implemented Role based Form Authentication. its working fine in my local. but this setting is not working in live server. ( my hosting service provider (DiscountASP) system.) my hosting service provider told me to set using REMOTE IIS MANAGER. i download, install and connect my site successful. But i don't know how to set my role and user authentication.

    my requirement is

    http://www.mysite.com
    allow to access user role only

    http://www.mysite.com/admin/
    allow to access admin role only

    its my web.config.

    <system.web>
    <authentication mode="Forms">
    <forms defaultUrl="default.aspx" loginUrl="logon.aspx" timeout="120" />
    </authentication>
    <authorization>
    </authorization>
    </system.web>

    <location path="Admin">
    <system.web>
    <authorization>
    <allow roles="admin"/>
    <deny users="*" />
    </authorization>
    </system.web>
    </location>
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    What doesn't work? Do you get an error or it doesn't send you to the login page?
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    so it just rejected your username / password?
     
  4. I have similar problem

    I have a similar problem to the person who started this thread.

    When I run my app on my local server (my laptop) everything works fine. I log in, I do my work, everything works fine, I log out. Note: when I run on my laptop I am accessing my online databases on my discountasp.net server.

    However, when I deploy my app to my discountasp.net server the user cannot login at all. I put in my user name and password, but the app just seems to ignore the login, there is no error or anything, the app just stays in anonymous mode instead of going to logged in mode.

    This did not happen before I enabled SQL Server Session (see http://support.discountasp.net/KB/a334/how-to-enable-aspnet-sql-server-session-on-your-web.aspx). Here are the relevant lines I added to my web.config file:

    <sessionState
    mode="SQLServer"
    allowCustomSqlDatabase = "true"
    sqlConnectionString="Data Source=tcp:sql2k511.discountasp.net;Initial Catalog=SQL2005_503839_gamevidence2;User ID=SQL2005_503839_gamevidence2_user;Password=*****;"
    cookieless="false"
    timeout="115" />

    I still want to use this so that users don't lose their session information when the work process is recycled.

    Any ideas? Thank you.
     
  5. If you implement .NET default role provider for roles based authentication you need to also set up your SQL server with the .NET role scripts so those database tables and stored procedures exist that let .NET talk to the SQL server. This step is CRUCIAL.
     

Share This Page