Attempting to access to the website giving the login and the password , i got this error
Server Error in '/' Application.
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An
unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 90: var r = from u in ge.userapp where u.password.Equals(passeword) && u.login.Equals(login) select u;
Line 91: userapp user = new userapp();
Line 92: user = r.First(); Line 93: Session["islogin"] = true;
Line 94: Session.Add("login", login);
Source File: C:\Users\1412\Documents\Visual Studio 2010\Projects\WebApplication4\WebApplication4\Default.aspx.cs Line: 92
Stack Trace:
[SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064458
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +81
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +273
System.Data.EntityClient.EntityConnection.Open() +184
System.Data.Objects.ObjectContext.EnsureConnection() +142
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +89
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +96
System.Linq.Enumerable.First(IEnumerable`1 source) +176
System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__0(IEnumerable`1 sequence) +74
System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +95
System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +162
System.Linq.Queryable.First(IQueryable`1 source) +265
WebApplication4._Default.recherche(Object sender, DirectEventArgs e) in C:\Users\1412\Documents\Visual Studio 2010\Projects\WebApplication4\WebApplication4\Default.aspx.cs:92
Ext.Net.ComponentDirectEvent.OnEvent(DirectEventArgs e) +71
Ext.Net.Observable.FireAsyncEvent(String eventName, ParameterCollection extraParams) +631
Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1921
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +37
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +291
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4225
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
And this is the whole code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext;
using DAO;
using Ext.Net;
using System.Xml;
using metier;
namespace WebApplication4
{
public partial class _Default : System.Web.UI.Page
{
public static Ext.Net.TreeNode r;
public static int i = 0;
gestionEntities ge = contextDAO.ge;
if (pas.Text != " " && log.Text != " ")
{
var passeword = pas.Text;
var login = log.Text;
try
{
var r = from u in ge.userapp where u.password.Equals(passeword) && u.login.Equals(login) select u;
userapp user = new userapp();
user = r.First();
Session["islogin"] = true;
Session.Add("login", login);
Session.Add("id", user.id);
Session.Add("iduserconnecte", user.id);
Response.Redirect("~/page-connection.aspx");
}
catch (InvalidOperationException )
{
FormStatusBar.StyleSpec = "color:red;font-size:21;";
FormStatusBar.SetStatus(new StatusBarStatusConfig { Text = "ressayer !!", IconCls = " ", Clear2 = false});
//msg.Text = "Login ou Password est incorrect";
This is your designer code, generated by EF. You should have an entry in your web.config <ConnectionStrings> with an connection string names 'gestionEntities'? can you paste this section
Please remember to Mark As Answer if helpful
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
faroukfisher
Member
9 Points
41 Posts
Authentification Error
Jul 25, 2012 07:57 AM|LINK
Hi everybody
Attempting to access to the website giving the login and the password , i got this error
Server Error in '/' Application.
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 90: var r = from u in ge.userapp where u.password.Equals(passeword) && u.login.Equals(login) select u; Line 91: userapp user = new userapp(); Line 92: user = r.First(); Line 93: Session["islogin"] = true; Line 94: Session.Add("login", login);Source File: C:\Users\1412\Documents\Visual Studio 2010\Projects\WebApplication4\WebApplication4\Default.aspx.cs Line: 92
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
And this is the whole code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext;
using DAO;
using Ext.Net;
using System.Xml;
using metier;
namespace WebApplication4
{
public partial class _Default : System.Web.UI.Page
{
public static Ext.Net.TreeNode r;
public static int i = 0;
gestionEntities ge = contextDAO.ge;
//public static void xmlparse( XmlNodeList l,XmlNode node, bool check, Ext.Net.TreeNode racine, bool hid, TreePanel t)
//{
// if (node.Attributes[2].Equals("feuille"))
// {
// dynamiq_treepaneltt.creer(node.Attributes[1].InnerText, Ext.Net.Icon.UserGray, racine, hid, node.Attributes[0].InnerText, check, "");
// }
// else
// {
// Ext.Net.TreeNode pere= dynamiq_treepaneltt.creer(node.Attributes[1].InnerText, Ext.Net.Icon.UserGray, racine, hid, node.Attributes[0].InnerText, check, "");
// foreach (XmlNode fils in node.ChildNodes)
// {
// xmlparse(l,l[i],false,pere,false,t);
// }
// }
//}
protected void Page_Load(object sender, EventArgs e)
{
Session["global"] = "fal";
Ext.Net.TreeNode racine = new Ext.Net.TreeNode();
racine.Text = "";
racine.Cls = "left";
racine.Icon = Ext.Net.Icon.ApplicationGo;
treep.Root.Add(racine);
treep.RootVisible = false;
racine.Expanded = true;
this.Context.Session.Add("islogin", false);
XmlDocument doc = new XmlDocument();
doc.Load("C:/Users/1412/Documents/Visual Studio 2010/Projects/WebApplication4/WebApplication4/treepanel.xml");
// XmlNodeList list = doc.GetElementsByTagName("noeud");
// xmlparse( list, false, racine, false, treep);
}
protected void touche(object seender,DirectEvent e) { id.Text = "rrr"; }
protected void recherche(object sender, DirectEventArgs e)
{
if (pas.Text != " " && log.Text != " ")
{
var passeword = pas.Text;
var login = log.Text;
try
{
var r = from u in ge.userapp where u.password.Equals(passeword) && u.login.Equals(login) select u;
userapp user = new userapp();
user = r.First();
Session["islogin"] = true;
Session.Add("login", login);
Session.Add("id", user.id);
Session.Add("iduserconnecte", user.id);
Response.Redirect("~/page-connection.aspx");
}
catch (InvalidOperationException )
{
FormStatusBar.StyleSpec = "color:red;font-size:21;";
FormStatusBar.SetStatus(new StatusBarStatusConfig { Text = "ressayer !!", IconCls = " ", Clear2 = false});
//msg.Text = "Login ou Password est incorrect";
}
}
}
}
}
So who can help me ?
christiandev
Star
8607 Points
1841 Posts
Re: Authentification Error
Jul 25, 2012 08:03 AM|LINK
Hi, where is your connection string ?
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
faroukfisher
Member
9 Points
41 Posts
Re: Authentification Error
Jul 25, 2012 08:12 AM|LINK
this is it Mr christiandev
App.config
christiandev
Star
8607 Points
1841 Posts
Re: Authentification Error
Jul 25, 2012 09:04 AM|LINK
This is your designer code, generated by EF. You should have an entry in your web.config <ConnectionStrings> with an connection string names 'gestionEntities'? can you paste this section
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
faroukfisher
Member
9 Points
41 Posts
Re: Authentification Error
Jul 25, 2012 10:11 AM|LINK
Sorry , i'm a Beginner in ASP.Net
this is App.config
faroukfisher
Member
9 Points
41 Posts
Re: Authentification Error
Jul 25, 2012 10:16 AM|LINK
and this is web.config
<?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <appSettings/> <connectionStrings/> <system.web> <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> </pages> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <remove name="ScriptHandlerFactory" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="ScriptResource" /> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </handlers> </system.webServer> <runtime> <assemblyBinding appliesTo="v2.0.05727" xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> <system.serviceModel> <services> <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior"> <!-- Service Endpoints --> <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1"> <!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WcfService1.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>christiandev
Star
8607 Points
1841 Posts
Re: Authentification Error
Jul 25, 2012 01:46 PM|LINK
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
faroukfisher
Member
9 Points
41 Posts
Re: Authentification Error
Jul 26, 2012 08:58 AM|LINK
Great Job Mr ChristianDev ...