By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

Profiles problem

P: n/a
Hello,

First, sorry because I am spanish and my english are not good.

My problem is that i am trying to work with profiles in visual studio 2005,
but i have an error.
the error is that:

"An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)."

My web aplication work correctly in the database access, but i use an class
library to get the conecctionString, not use the connectionString from
web.config.

The code of the web.config is:
--*******************-----------
<connectionStrings>
<add name="MainConnStr" connectionString="data source=BAMP-SRV-02;initial
catalog=EJEMPLO_CULTURAS;password=sa;persist security info=True;user id=sa"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<anonymousIdentification enabled="true"/>
<profile>
<providers>
<remove name="SqlProvider" />
<add
name="SqlProvider"
connectionStringName="MainConnStr"
applicationName="EjemploCulturasASP"
type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>
<add name="LanguagePreference" type="System.String"
defaultValue="Auto" allowAnonymous="true" />
<add name="Age" type="System.Int32"
defaultValue="0" allowAnonymous="true" />
<add name="Gender" type="System.String"
defaultValue="" allowAnonymous="true" />
<add name="Country" type="System.String"
defaultValue="Auto" allowAnonymous="true" />
</properties>
</profile>

<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="Microsoft.Office.Tools.Excel, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.Office.Tools.Word, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="Microsoft.Office.Interop.Excel, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
<add assembly="office, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71E9BCE111E9429C"/>
<add assembly="Microsoft.Vbe.Interop, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71E9BCE111E9429C"/>
<add assembly="Microsoft.Office.Interop.Word, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
<add assembly="Microsoft.Office.Tools.Common, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="VSTOStorageWrapper.Interop, Version=8.0.0.0,
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="stdole, Version=7.0.3300.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.VisualStudio.Tools.Application s.Runtime,
Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.Office.Interop.SmartTag, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
<add
assembly="Microsoft.VisualStudio.OfficeTools.Contr ols.ManagedWrapper,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrorssection 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>
-->
</system.web>

-******************------

And I am trying to make an generic class for the aplication pages:

-**************-
using System;
using System.Data;
using System.Configuration;
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.Globalization;
using System.Threading;
using System.Web.Profile;
public class PageHereda: System.Web.UI.Page
{
protected override void InitializeCulture()
{
base.InitializeCulture();
ProfileCommon perfil = (ProfileCommon)Context.Profile;
string languagePreference = perfil.LanguagePreference.ToString();

}
}

-*****************-

When I try to access to perfil.LanguagePreference give me the error:
"An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)."
May 30 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.