Showing posts with label godaddy. Show all posts
Showing posts with label godaddy. Show all posts

Sunday, April 26, 2015

How to upload Database in Godaddy Server, explain with images

As a request form one of my follower I am writing this post about how to upload your Ms. SQL Server Database. Just follow my steps and in new few minutes your database will be on line in your Godaddy server.

Step 1:
First generate a script of your database with data (Schema & data).

Step 2:
Open your Godaddy server login into it and Go to Web Sites and Domain section. There is a link for Database (marked in pic) section. Click on it and you will be redirect to Database section.


Step 3:
Right now there is no database exists. So you have to create a new one. Click on the Add new database button and go to Add New Database page.

Step 4:
Here you have to enter your database name and  choose Microsoft SQL Server from Type drop down list.
Now its come to the user part. Here I don't have an exiting user so I have to create an user to access the database. So enter the user name and password for the user. You can generate the password for user also.
After all entry click on the OK button and if there is no issue you will be redirect to the previous page where you can see that you have a database with your given name and its user.  Now your database is created and you can add your tables, stored procedures, functions, views  and also insert data.

Note: make a note of the provided IP address and pin no. It will use in case of writing connection string in your web.config file.



Step 5:
To modify your database click on the webadmin link on the right side of your database. It will redirect you to a database management tool.



Step 6:
Click on the Tools section and within that on New Query button.


Step 7:
A new editor will be open for you to write sql query in it. Now copy and paste your local database script into this editor and click on the submit button.


Step 8:
After few minutes(as per your database size) your database will be on line. Now go back to your project. You have to change the connection string of you web.config file to attach this on line database.


Add the following connection string:

<add name="mlm_real_1050ConnectionString" connectionString="Data Source=<IP address>,<PIN No>; Initial Catalog=<Database name>;Network Library=DBMSSOCN;User ID=<User Name>;Password=<Password>;"      providerName="System.Data.SqlClient" />

Now upload your project and enjoy with your website.

Tuesday, June 10, 2014

How to send mail from GoDaddy server in ASP.NET C#


I found some errors in sending mail from a GoDaddy server, and after searching a lot I found the correct solution to send mail.

First add these namespaces in your project





using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.Net.Mail;

Now the send mail method is



public void Send_User_Confirmation_Mail()
{
    MailMessage mail = new MailMessage();
    mail.To.Add("<email to send>");
    mail.From = new MailAddress("<send mail>");
 
    mail.Subject = "Account Created.";
          
    string Body = "<body>";
 
    mail.Body = Body;
    mail.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "relay-hosting.secureserver.net";
    smtp.EnableSsl = true;
    smtp.Credentials =  
      new System.Net.NetworkCredential("<send email>"), "<send password>");
    ServicePointManager.ServerCertificateValidationCallback =  
      delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
      { return true; };
    smtp.Port = 25;
    smtp.Send(mail);
}

These are main things to add with your normal mail sending code.



smtp.Host = "relay-hosting.secureserver.net";
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["Send_Mail_From_Email"].ToString(), ConfigurationManager.AppSettings["Send_Mail_From_Password"].ToString());
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
smtp.Port = 25;

Before adding there 3rd line of credential I was getting error of some invalid certificate issue to send a mail. But adding these all the issue become normal and mail is sending without any problem.

Popular Posts

Pageviews