Exceptions when checking User Role

Discussion in 'Databases' started by glenndoren, Oct 26, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. My site exceptions (being run from the discountasp server) when i do the following check:

    if (User.IsInRole("Admin"))....

    It gives me the error listed below. The Roles Management tables are setup (in my database folder). If i comment out this line, my site runs fine and the user can login without a prob.

    So clearly it isnt able to access the role management tables. But i'm able to access my other site dbases without a problem.

    Ideas?

    thx!
    --g


    Login failed for user ''. The user is not associated with a trusted SQL Server connection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

    Source Error:





    Code:
    Line 29:             ZipTxtBx.Text = userInfo.LastZipcode.ToString(); // should be set to saved last location
    Line 30:         }
    Line 31:         if (User.IsInRole("Admin"))
    Line 32:         {
    Line 33:             AdminLnkBtn.Visible = true;
     
  2. Hmmm... well, thanx for the link :) Unfortunately, i already have all of that covered. This actually works fine on my localhost--it simply fails after i copy my site over to my discountasp server. Then i run into this error. So I'm wondering--if something has to be installed on my discountasp server(?) Otherwise, maybe there's a connection string problem that seems to work on my localhost but not on the hosting server...


    Any other ideas folks?


    thx,


    --glenn
     
  3. Can't think of anything but I'm sure Bruce or one of the other DASP guys will respond soon. [​IMG]
     
  4. What does your roleManager configuration look like in the web.config?

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. hmmm... <rolemanager enabled="true" /> is all i have.


    it works on my localhost... do i need more to work off the discountasp server?
     
  6. So it means that it isusing the default connection string called "LocalSqlServer". Do you have such a connection string in your web.config? If so make sure that it's valid and connects to your DiscountASP SQL server with the right username and password. See this KB, http://kb.discountasp.net/article.aspx?id=10413.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page