using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
} protected void Button1_Click(object sender, EventArgs e) { string aa = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; SqlConnection con = new SqlConnection(aa); con.Open(); string name = TextBox1.Text; string pwd = TextBox2.Text;
Marsh Posté le 14-08-2015 à 10:11:13
Hi All,
My apologize if I write in English because I just migrated to France and my French is not so good. I just keep learning.
I have hosted my asp.net site with hostforlife.eu windows hosting. I am getting error 500 internal server error
In the web.config file I have included
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
this is my web.config file<connectionStrings>
<add name="conn" connectionString=" Server=xxx.db.xxxx.hostedresource.com; Database=xxx; User ID=xxx; Password=xxx; Trusted_Connection=False" providerName="System.Data.SqlClient" /> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString=" Server=xxx.db.xxxx.hostedresource.com; Database=xxx; User ID=xxx; Password=xxx; Trusted_Connection=False" providerName="System.Data.SqlClient" />
</connectionStrings>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
This is my code behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string aa = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
SqlConnection con = new SqlConnection(aa);
con.Open();
string name = TextBox1.Text;
string pwd = TextBox2.Text;
string str = "insert into login values('" + name + "', '" + pwd + "', '" + pwd + "', '" + pwd + "')";
SqlCommand cmd = new SqlCommand(str, con);
cmd .ExecuteNonQuery ();
}
}
Could you please kindly point what is the issue? Any suggesstion?
Thank you