Page Redirect Problem

Discussion in 'Site Programming, Development and Design' started by JackWebb, Jun 16, 2010.

  1. any help with this will be most appreciated.

    All of a sudden, some of my page re-directs are not working.

    when I click a button to display the details of an item in a gridview with:
    Master.PushAndGo("~/DisplayJob.aspx", myPageUrl);
    all works fine.

    But when I click a button that issues this :
    Master.PushAndGo("~/Contractor/frm_InsJob.aspx", myPageUrl);
    and consider that I just made a change to this page,

    I get an error 26, the bowels of which show that I'm trying to reach:

    AGMA_NetWebApp.Contractors.frm_InsJob.Page_Load(Object sender, EventArgs e) in C:\Users\Jack\Documents\Visual Studio 2008\Projects\AGMA_NetWebApp\AGMA_NetWebApp\Contractor\frm_InsJob.aspx.cs:47

    which is a page in my WebApplication.

    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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
    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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    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:


    [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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849719
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4863021
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
    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) +31
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
    System.Data.SqlClient.SqlConnection.Open() +122
    System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +44
    System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() +45
    System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() +20
    System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +57
    System.Data.Linq.Table`1.GetEnumerator() +43
    System.Data.Linq.Table`1.System.Collections.Generic.IEnumerable<TEntity>.GetEnumerator() +4
    System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +7667686
    System.Linq.Enumerable.ToList(IEnumerable`1 source) +61

    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
    System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
    System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +261
    System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
    System.Web.UI.WebControls.LinqDataSourceView.ToList(IQueryable query, Type dataObjectType) +126
    System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelectQuery(LinqDataSourceSelectEventArgs selectEventArgs, Object selectResult, Object table, Boolean storeOriginalValues) +327
    System.Web.UI.WebControls.LinqDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +457
    System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
    System.Web.UI.WebControls.ListControl.PerformSelect() +34
    System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
    AGMA_NetWebApp.Contractors.frm_InsJob.Page_Load(Object sender, EventArgs e) in C:\Users\Jack\Documents\Visual Studio 2008\Projects\AGMA_NetWebApp\AGMA_NetWebApp\Contractor\frm_InsJob.aspx.cs:47
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +50
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016
     
  2. Ray

    Ray

    This error "provider: SQL Network Interfaces, error: 26" is associated to an application trying to connect to a SQL Express database. We do not support SQL Express because of its lack of security. You'll need to go through your code and drop any calls to a SQL Express database and update the connection string to point to the database on our SQL Server.
     
  3. i agree about the error 26. and will research. thks
     
  4. Ray,
    Sorry to bother you, but........
    I found it. Consider this:
    I was only clicking a page in the menu, which is datasourced by a web.sitemap.
    I also use SQL Membership and Role Providers.
    These point to the ASP.Net SqlMembership Tables; which I have incorporated into my application.

    I'm using LINQ, which implies an OR/M. This puppy had a deep rooted reference to my test environment, or ./SQLEXPRESS

    Since I was clicking on a page to visit, the Menu command had to see if I had a role allowed to visit the page. Hence it tried to open the SQL Membership and Role Tables.

    I guess your keywords to save the problem would include "SQL Membership" and "LINQ".

    Thanks again.
     
  5. Ray

    Ray

    Not necessarily. Many ASP.Net web applications by default will point to ./SQLEXPRESS. So I cannot say for sure what ASP.Net application is running. To understand it a little more clearer, obviously most ASP.Net applications are created on a personal computer. Typically that person will have Visual Studio and SQL Express installed. So naturally the database connection is set to ./SQLEXPRESS.

    What most customers fail to do is to import the database from SQL Express on their computer to the Winhost SQL Server and update the connection strings. Incidentally with IIS 7 updating the connection string is much simpler. Simply use IIS 7 Manager to connect to our web server. From there you can see a button called Connection String. You can double click on it and you can set your connection string. Basically what this will do is code it directly on your web.config file for you.

    Now remember, depending on how you setup the account, you can have multiple ASP.Net web applications. Each sub directory may have its own web.config file so you'll need to navigate to those folders individually and set the connection string to the correct SQL server.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page