Hosting ASP.NET Website

We are going to discuss how to host your ASP.NET website to make it live using a hosting account which you may have purchased. If not, then please get one accordingly with the domain name.

Step 1:

Firstly, you have to register for your domain name. After getting your domain name login to your hosting account using your user Id and password.

In your Login panel go to your account tab and then choose MyProducts. In this product page you will find out the following services.

page
                                                      Figure 1: My Product Page

In this page click Manage button straight to the web hosting services. In this page you have to find out the following options.

page
                                                      Figure 2: Site Options Page

Click the Open Site link placed after File Manager, it takes you to the file location, that is httpdocs directory folder.

In this httpdocs folder you have to place all your Asp.net *.aspx, *.aspx.cs, *.css, *.js and your Images folder.

Step 2:

After uploading all files in your project into that httpdocs folder, you have to create the database for your project. In the above image click Add New Database link and it will take you to the phpMyAdmin page for creating your database.

page
                                                         Figure 3: phpMyAdmin page

In above image click Databases and then click create new database. Enter your database name, collation and hit Go to create new database.

After pressing Go your database is created and it can be viewed on the left hand side of your phpMyAdmin page. Then click the database and the following window will appear,

create
                                                           Figure 4: Create Table

In this above image click Create table tab to create your new table for your database. Mention fields and its type and strength and set the primary key for your table and then hit Go button to create table.

After table creation you have to link your *.aspx.cs into your database. Here is connection string coding to connect database into your aspx page.

Some hosting providers use MySQL for database, so we need server IP address and then the port number for MySQL, then only we can connect to the database.

After database is  you can view the IP Address and then the port number of your database is placed after your database. Here is the example image.

ip
                                       Figure 5: Ip Address and port number

Now you have to add MySql.Data.dll reference into your project reference folder. Here is my article link for connecting MySQL database in ASP.NETgo through the link and download the dll file here.

After downloading your dll file select your project and click add reference tab then add this dll into your project.

Now the coding is as follows.

Reference:

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Web;  
  4. using System.Web.UI;  
  5. using System.Web.UI.WebControls;  
  6. using System.Data;  
  7. using MySql.Data.MySqlClient;  
Connection String:
  1. MySqlConnection con = newMySqlConnection("Data Source=Server IP Address;port=3306;Initial Catalog=SSFFDB;User ID=ssff; Password= SSFF123!;");  
Mysql Command sample:
  1. MySqlCommand cmd = newMySqlCommand("Insert into table_name(table_fileds) values()", con);  
  2. cmd.ExecuteNonQuery();  

Read more articles on how to host a website: