Implementing a project (ASP.net)

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,172
Location
Barrow-In-Furness
I'll soon be implementing my first project and i've got a couple of questions.

1)

I'm unsure about how to create the first user (admin). What I mean is, if the first user signs up typically they will not be given a role (standard user) and thus will not be able to change their role through the role management page as it's only available to those in the 'Managers' role.

Should I just create the first admin user locally then it will already exist when the database is uploaded?

2)

At the moment when i'm working on the project the database is not on this machine, it's on another local machine. That means my connect string points to this.

When I implement the project the web server will be on a different server from the SQL Server again, so i'm guessing my connection string will need to reflect this.

Is my connection string in my web.config simply need to be changed so it points to the new SQL server or will this impact other areas?

Thanks!
 
1) I would do what you suggest...

2) Yes you will only need to change your connection string within the web.config file

Stelly
 
I'd personally place two connection strings within my web.config file. A local database connection string (development environment) and a live database connection string (live environment).

You could then write a method to determine which connection string to use, depending on what host the site is currently running on. That way, you do not have to change the connection string everytime you deploy the web application. For example:

Code:
public string GetConnectionString()
{
   String host = Request.Url.Host.ToString();
   String retval = String.Empty;

   if ((host.Equals("127.0.0.1")) || (host.Equals("localhost")))
   {
      retval = WebConfigurationManager.ConnectionStrings["LocalConn"].ToString();
   }
   else
   {
      retval = WebConfigurationManager.ConnectionStrings["LiveConn"].ToString();
   }

   return retval;
}

Hope this helps.

Danny.
 
That's not a bad idea, unfortunately i'm voding in VB and don't really have the knowledge on how to do that at the moment.

The connection string is in my web.config :)
 
Back
Top Bottom