Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "jubeh"

I have an ASP.NET site hosted with [http://asphostportal.com]) , My ASP.NET page which has a small form to handle enrollment into his course.

Obviously the data from this form has to be inserted into a database.

My problem lies in the actual connection to the database server, I have it on my local PC, for testing purposes.

I can connect to the server just fine through my SQL Server Management Studio, however when I try to connect from my web application (uploaded it to a free host purely for testing), it gives me this error :

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - An attempt was made to access a socket in a way forbidden by its access permissions.)

After extensive Google'ing and rewriting the connection string in my web.config file, I still can't find what's going wrong exactly.

I know for a fact that the DNS I'm using works, as a friend of mine has already tested it several days ago by connecting through his own SQL Server Management Studio.

Here's my web.config: (blanked out the password in the constring, obviously)

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
    <customErrors mode="Off"/>
  </system.web>
  <appSettings>
      <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <connectionStrings>
     <add name="SQLCS" 
          providerName="System.Data.SqlClient"   
          connectionString="Server=ydekempe.ddns.net,5555\Cocktails;Database=Website;Integrated Security=False;User ID=WebUser;Password=********;"/>
  </connectionStrings>
</configuration>

And just for being complete in providing you everything you may need, here's the code for the actual connection:

protected void Inschrijven(object sender, EventArgs e)
{
    int uid = 0;
    string conStr = ConfigurationManager.ConnectionStrings["SQLCS"].ConnectionString;

    try
    {
        using (SqlConnection conn = new SqlConnection(conStr))
        {
            using (SqlCommand cmd = new SqlCommand("Inschrijven", conn))
            {
                using (SqlDataAdapter sda = new SqlDataAdapter())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@naam", txtNaam.Text.Trim());
                    cmd.Parameters.AddWithValue("@voornaam", txtVoorNaam.Text.Trim());
                    cmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim());
                    cmd.Connection = conn;
                    conn.Open();
                    uid = Convert.ToInt32(cmd.ExecuteScalar());
                    conn.Close();
                }
            }
        }
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }
    string msg = "";
    switch (uid)
    {
        case 0:
            msg = "Er ging iets mis.\\nProbeer later opnieuw";
            break;
        case -1:
            msg = "Dit e-mail adres is al in gebruik.";
            break;
        default:
            msg = "Inschrijving verwerkt.";
            break;
    }
    ClientScript.RegisterStartupScript(GetType(), "Boodschap", "Boodschap: '" + msg + "');", true);
}

PS: The actual connection info is IP: ydekempe.ddns.net & Port: 5555 Just in case you were wondering.

Hi there..

How can I know if a shared hosting supports MVC6? Many hosting companies only state that they support .Net 4.5, 4.0, 3.5, 3.0, 2.0 Framework and ASP.NET like asphostportal.com or hostforlife.eu . They don't state specifically if they support MVC6. Did they really support ?

Coming from the PHP world, I'm still very new to ASP.net and its MVC framework. Is it right to say that as long as the server supports ASP.net and .NET 4.0 and above, all I have to do is just upload my web application (the asp files) together with MVC5 framework binaries to my account and it will work?

In other words, the server doesn't really need to "support" MVC6, but just need the .NET 4 runtime?

Showing 1 to 2 of 2 entries