How to fix common errors in sitecore





How to fix common errors in sitecore


Check Connection strings in \Website\App_Config\ConnectionStrings.config


The network path was not found
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.ComponentModel.Win32Exception: The network path was not foundSource Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[Win32Exception (0x80004005): The network path was not found]

[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.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection     owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +671
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection     owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1012
   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6711619
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +152
   System.Data.SqlClient.SqlConnection.Open() +229
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +150
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +4874450
   System.Web.Security.SqlMembershipProvider.GetUser(String username, Boolean userIsOnline) +1729
   Sitecore.Security.SitecoreMembershipProvider.GetUser(String username, Boolean userIsOnline) +51
   System.Web.Security.Membership.GetUser(String username, Boolean userIsOnline) +175
   Sitecore.Security.Domains.Domain.CreateAnonymousUserIfNeeded() +56
   Sitecore.Pipelines.Loader.EnsureAnonymousUsers.Process(PipelineArgs args) +143
   (Object , Object[] ) +80
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +191
   Sitecore.Nexus.Web.HttpModule.Application_Start() +160
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +619
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr     appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): 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.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12722601






It’s because .net framework 4.5 is installed on the server
Change the  \Website\Web.config

<setting name=”Login.RememberLastLoggedInUserName” value=”false” />

 Server Error in '/' Application.


Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.

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.ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
 
[ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.]
   System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) +185
   System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) +122
   System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +206
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +126
   Sitecore.SecurityModel.Cryptography.CookieProtectionHelperWrapper.Encode(CookieProtection cookieProtection, Byte[] buf, Int32 count) +175
   Sitecore.sitecore.login.LoginPage.WriteCookie(String name, String value) +94
   Sitecore.sitecore.login.LoginPage.Login_LoggingIn(Object sender, LoginCancelEventArgs e) +133
   System.Web.UI.WebControls.Login.AttemptLogin() +108
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +93
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +84
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929