Jump to content

Problems with seemingly simple MSDN Profile Properties example project


K_Drive

Recommended Posts

I am trying to complete what seems like a very simple example project on MSDN to learn how to use Profile Properties that are set up in the web.config file for an ASP.Net/C# project. Here is the link to the MSDN page:MSDN Profile Properties walkthrough I followed the C# steps on this page for the first simple project up to "To test the PostalCode property". I am getting the error below when I run/debug. I am using Visual Studio. I also have SQL Server. I copied/pasted the code. I am getting a server error listed at the end of this post. If I am reading the MS web page correctly, the first simple example uses the anonymousIdentification element. So, no login is necessary I set up this simple project in a new page within an existing project that has a database. I can see the Profile table in SQL Server. But, the app just can't seem to get to it. Is there something else I need to get profiles to work involving the database? -- error listing: -- System.Web.HttpException was unhandled by user codeMessage="Unable to connect to SQL Server database."Source="System.Web" ErrorCode=-2147467259 StackTrace: at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString) at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) at System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) at System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties) at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) at System.Configuration.SettingsBase.get_Item(String propertyName) at System.Web.Profile.ProfileBase.GetInternal(String propertyName) at System.Web.Profile.ProfileBase.get_Item(String propertyName) at System.Web.Profile.ProfileBase.GetPropertyValue(String propertyName) at ProfileCommon.get_PostalCode() in c:\Users\amredstart\AppData\Local\Temp\Temporary ASP.NET Files\website1\839131dc\b553a82a\App_Code.ocx-hpma.0.cs:line 21 at _Default.Page_Load(Object sender, EventArgs e) in c:\Users\amredstart\Documents\Visual Studio 2005\Projects\WebSite1\CustomerProfiles.aspx.cs:line 16 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Edited by K_Drive
Link to comment
Share on other sites

  • 3 weeks later...

"Unable to connect" sounds like the database server is not reachable or not accepting connections, or that your login failed. The way I read the MSDN page, the anonymousIdentification element doesn't have anything to do with database authentication.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...