locked
how to register as adminstrator ?? RRS feed

  • Question

  • User148603208 posted

    hi i'v installed cube site starter kit on web server and it's working fine

    how can i register my self as admin ? i tried to register in the  with username administrator but it still normal user

    and when i'm trying to open web.config i get erroe message

    i'm still new at asp.net so i dont know alot of thing 

    Server Error in '/ClubWebsite' Application.

    This type of page is not served.

    Description: The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.config' may be incorrect.   Please review the URL below and make sure that it is spelled correctly.

    Requested URL: /ClubWebsite/web.config

    Friday, February 16, 2007 3:51 PM

All replies

  • User-1139504151 posted

    You can't open the web.config from a browser.

    If your club site is on a shared host, you will need to make the changes necessary in the database.

    First, select * from aspnet_Users.  What you are looking for is the UserId for the UserName that you want to make an administrator.

    Then, select * from aspnet_Roles.  What you are looking for is the RoleId for the RoleName of Administrators. 

    Finally, you want to insert into aspnet_UsersInRoles the UserID that you got from the first step and the RoleId you got from the second step.

     

    Or make yourself a temp page that has the following code in it.  Then after you log into the site, visit this page.

    You will need to put this in a temp aspx page.  Call it by adding ?UserName=<whatever your username is> to the end of the URL.

    Dim userName as String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         'retrieve the username from the querystring
         userName = Request.QueryString("UserName")
         If Request.QueryString("UserName") Is Nothing Then
              Response.Redirect("~/Default.aspx")
         End If
    
         Dim userRoles() as String = {"Administrator"}
         Dim userNames() As String = {userName}
    
         Roles.AddUsersToRoles(userNames,userRoles)
    End Sub

     Just make sure you delete this page after you have made one administrator!

    Friday, February 16, 2007 9:03 PM
  • User148603208 posted

    ok i did this

    put this code (without change) in new page temp.aspx then i went to the site and log in

    then i called this page

    ../clubwebsite/temp.aspx?username=Administrator

    but nothing happend i got this code in the broswer 

    what is wrong here??? 

    Saturday, February 17, 2007 1:43 PM
  • User148603208 posted

    finally i can connect to the database and i can modify db (i had problem before in connected)

    so now i got the UserID and RoleId  how do i insert the values into aspnet_UsersInRoles ??

    every time i made new query i can't execute i get error


      insert into aspnet_UsersInRoles where UserID = " userid......" and RoleId = "RoleId ......"

    what is the wrong with this query ?? 

    Saturday, February 17, 2007 4:54 PM
  • User-1139504151 posted

    Your query should be

    INSERT INTO aspnet_UsersInRoles(UserId, RoleId) VALUES ("user guid", "role guid")

     

    Like I said above, the only thing that goes into this table is guids.  Your guids will look something like this: 0b8f7469-2c8e-4902-b275-a2e572008644

    Sunday, February 18, 2007 8:22 PM
  • User-80939892 posted

    In almost all cases writing directly to the asp membership tables should be avoided..

    Use the vs2005 ASP.NET configuration tool to create at least one administrators role and user.

    You can create a custom member administration page to add/remove members to/from your sites roles. My website framework has a member administrator page that includs this functionality and much more. You can view my site (modified version of the club site. School Site framework). If you like the way it looks and would like a copy of the code then I will direct you to the source on my ftp site. www.jeromessite.com.

     e-mail: jerome@jeromessite.com

     Hope this helps,

    Wednesday, February 28, 2007 1:57 PM