Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 17: public partial class home : System.Web.UI.Page
Line 18: {
Line 19: SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString.ToString());
Line 20: protected void Page_Load(object sender, EventArgs e)
Line 21: {

Source File: e:\0\2\17\38\2669038\user\2930392\htdocs\home.aspx.cs Line: 19

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
home..ctor() in e:\0\2\17\38\2669038\user\2930392\htdocs\home.aspx.cs:19
ASP.home_aspx..ctor() in App_Web_home.aspx.cdcab7d2.zddxi6v4.0.cs:0
__ASP.FastObjectFactory_app_web_home_aspx_cdcab7d2_zddxi6v4.Create_ASP_home_aspx() in App_Web_home.aspx.cdcab7d2.zddxi6v4.2.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

pleaes help with a solution

5 Years
Discussion Span
Last Post by kamilacbe

Please debug and check what is your connection string value from Web.Config. Is it correct? Try to open the connection. See what is error message.



Check for your connection string path ..

And please mark it as solved if it helped you out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.