By default we have SQL Server CE , while using CE i get a localsqlserver error.
I wanna use SQL Server 2008 provided by hostgator for the startersite
plzz help me
how can i connect my web application to a SQL Server database tat sits on the hostgator server ??
plzz provide an example connection string
Is it compulsory to use Web Deploy ?
Thanks in advance
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
I tried connecting my Hostgator SQL Servre 2008 Database with the startersite
but still i am getting this error
plz help
Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
Source Error:
Line 246: <membership>
Line 247: <providers>
Line 248: <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
Line 249: <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
Line 250: </providers>
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 248
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Server Error in '/' Application.
--------------------------------------------------------------------------------
Connection string "StarterSite" 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.InvalidOperationException: Connection string "StarterSite" was not found.
Source Error:
Line 2:
Line 3: @{
Line 4: WebSecurity.InitializeDatabaseConnection("StarterSite", "UserProfile", "UserId", "Email", autoCreateTables: true);
Line 5:
Line 6: // To let users of this site log in using their accounts from other sites such as Facebook, Twitter,
Source File: c:\inetpub\vhosts\abhishekluv.in\starter\_AppStart.cshtml Line: 4
Stack Trace:
[InvalidOperationException: Connection string "StarterSite" was not found.]
WebMatrix.Data.Database.OpenNamedConnection(String name, IConfigurationManager configurationManager) +132
WebMatrix.Data.Database.Open(String name) +42
WebMatrix.WebData.DatabaseConnectionInfo.Connect() +44
WebMatrix.WebData.SimpleMembershipProvider.ConnectToDatabase() +26
WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded() +41
WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider sMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +70
WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +51
WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +52
ASP._Page__AppStart_cshtml.Execute() in c:\inetpub\vhosts\abhishekluv.in\starter\_AppStart.cshtml:4
System.Web.WebPages.ApplicationStartPage.<ExecuteInternal>b__0() +49
System.Web.WebPages.ApplicationStartPage.<GetSafeExecuteStartPageThunk>b__3(Action action) +7
System.Web.WebPages.ApplicationStartPage.ExecuteInternal() +64
System.Web.WebPages.ApplicationStartPage.ExecuteStartPageInternal(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +168
System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +39
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +85
System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application) +128
System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application, Action`1 executeStartPage, EventHandler applicationStart) +84
System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application) +53
System.Web.WebPages.WebPageHttpModule.Init(HttpApplication application) +179
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +517
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253
[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090908
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Thanks to all for helping and replying to this post :)
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Thanks
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Abhishek Luv
Participant
1736 Points
468 Posts
How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 06, 2012 12:04 PM|LINK
By default we have SQL Server CE , while using CE i get a localsqlserver error.
I wanna use SQL Server 2008 provided by hostgator for the startersite
plzz help me
how can i connect my web application to a SQL Server database tat sits on the hostgator server ??
plzz provide an example connection string
Is it compulsory to use Web Deploy ?
Thanks in advance
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Careed
All-Star
18764 Points
3637 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 06, 2012 01:33 PM|LINK
Since I am not familiar with HostGator's capabilities, your first question should be to them. Is HostGator able to support a SQL Server CE database?
"The oxen are slow, but the earth is patient."
GmGregori
Contributor
5448 Points
736 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 06, 2012 02:08 PM|LINK
The connection string must be included in web.config file.
The example in the following is of a web.config file with a connection string for a SQL Server 2008:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <connectionStrings> <add connectionString="Server=myServerAddress;Database=myDataBase;ID=myUsername;Password=myPassword;Trusted_Connection=False" name="connectionName" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>You must provide:
No, use Web Deploy is not compulsory. You can deploy your files with FTP too.
Abhishek Luv
Participant
1736 Points
468 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 02:45 AM|LINK
<?xml version="1.0" encoding="UTF-8"?> <configuration> <connectionStrings> <add connectionString="Data Source=myipaddress\MSSQLSERVER2008;Initial Catalog=StarterSite;User ID=abhishek_site;Password=noki@7210" name="StarterSite" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Abhishek Luv
Participant
1736 Points
468 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 02:54 AM|LINK
Now i am getting this error
Server Error in '/' Application. -------------------------------------------------------------------------------- Connection string "StarterSite" 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.InvalidOperationException: Connection string "StarterSite" was not found. Source Error: Line 2: Line 3: @{ Line 4: WebSecurity.InitializeDatabaseConnection("StarterSite", "UserProfile", "UserId", "Email", autoCreateTables: true); Line 5: Line 6: // To let users of this site log in using their accounts from other sites such as Facebook, Twitter, Source File: c:\inetpub\vhosts\abhishekluv.in\starter\_AppStart.cshtml Line: 4 Stack Trace: [InvalidOperationException: Connection string "StarterSite" was not found.] WebMatrix.Data.Database.OpenNamedConnection(String name, IConfigurationManager configurationManager) +132 WebMatrix.Data.Database.Open(String name) +42 WebMatrix.WebData.DatabaseConnectionInfo.Connect() +44 WebMatrix.WebData.SimpleMembershipProvider.ConnectToDatabase() +26 WebMatrix.WebData.SimpleMembershipProvider.CreateTablesIfNeeded() +41 WebMatrix.WebData.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider sMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +70 WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +51 WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +52 ASP._Page__AppStart_cshtml.Execute() in c:\inetpub\vhosts\abhishekluv.in\starter\_AppStart.cshtml:4 System.Web.WebPages.ApplicationStartPage.<ExecuteInternal>b__0() +49 System.Web.WebPages.ApplicationStartPage.<GetSafeExecuteStartPageThunk>b__3(Action action) +7 System.Web.WebPages.ApplicationStartPage.ExecuteInternal() +64 System.Web.WebPages.ApplicationStartPage.ExecuteStartPageInternal(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +168 System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +39 [HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.] System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application, Action`1 monitorFile, IVirtualPathFactory virtualPathFactory, IEnumerable`1 supportedExtensions) +85 System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application) +128 System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application, Action`1 executeStartPage, EventHandler applicationStart) +84 System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application) +53 System.Web.WebPages.WebPageHttpModule.Init(HttpApplication application) +179 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +517 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253 [HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090908 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
Careed
All-Star
18764 Points
3637 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 04:00 AM|LINK
You're using a SQL Server connection string for a SQL Server Compact database. This will not work.
So, let's try this again: You need to ask the support people at HostGator to see if they even support SQL Server CE SDF database.
"The oxen are slow, but the earth is patient."
Abhishek Luv
Participant
1736 Points
468 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 04:53 AM|LINK
Successfully deployed the StarterSite using SQL Server 2008 at Hostgator
I read a post by mikesdotnetting here in the forum , that we need to pass the database connectionString to the
WebSecurity.InitializeDatabaseConnection("StarterSite", "UserProfile", "UserId", "Email", autoCreateTables: true);This is my Web.config file
<?xml version="1.0"?> <configuration> <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="dummy" /> <add name="StarterSite" connectionString="Server=myipaddress\MSSQLSERVER2008;Database=StarterSite;User ID=myuserid;Password=mypassword;Trusted_Connection=False" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.0"/> </system.web> <system.web> <customErrors mode="Off"/> </system.web> </configuration>Thanks to all for helping and replying to this post :)
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv
GmGregori
Contributor
5448 Points
736 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 06:40 AM|LINK
At first sight it seems like you have made the right steps to implement SimpleMembership.
If you don't receive any error message, you should look at tutorials for becoming accustomed with Razor security:
THE most basic way to implement ASP.NET Razor security
Adding Security and Membership
WebSecurity Class
Abhishek Luv
Participant
1736 Points
468 Posts
Re: How can we connect a ASP.NET web pages application to a SQL Server Database on Hostgator
May 07, 2012 06:51 AM|LINK
Thanks for those helpful and useful links :)
With Regards
Abhishek Rajiv Luv
"Helpful then please Mark as Answer"
http://www.codeabstract.com/
http://pluralsight.com/training/users/abhishekluv