User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,610 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,211 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2945 | Replies: 4
Reply
Join Date: Mar 2007
Posts: 14
Reputation: someoneelse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
someoneelse someoneelse is offline Offline
Newbie Poster

Help built in login and createuser wizard but for a remote SQL database? how to change?

  #1  
Apr 26th, 2007
I am trying to implement an example of the built in login and createuser wizard. the ony problem is, (and this may be really retarded of me) is that when i publish it out to a web server it doesn't work. Of course, it works perfect locally.

Does the aspnetdb.mdf that runs on my computer not run on the real server?

Ideally, I want this to run off a remote SQL database, but I am not sure how to set that up... I see in the help and online that I am aupposed to be able to slect another source to store this data on the "Provider" tab, but I don't see that optoin.

When I click the ASP.NET Configuration Tool all i can see on the page for my optoins are:
--------------------------------
Use this page to select a provider for each feature.

Membership Provider
AspNetSqlMembershipProvider -CHECKED


Role Provider
AspNetSqlRoleProvider -CHECKED
AspNetWindowsTokenRoleProvider

-------------------------------------
So, I'd like to know the answer to 2 questions:
1-Can the aspnetdb.mdf that runs on my computer run on the real server?
2-how can I convert this to use a remote SQL database, ie, I can't see where to set the datasource as I do in the drigeview, detailsview etc portions of the visual web devloper express program...

Thanks For Your Help!

Andrea
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: built in login and createuser wizard but for a remote SQL database? how to change?

  #2  
Apr 26th, 2007
I think there's a way to attach the mdf file to Sql Server on the remote host during deployment or in the application config or something. I've never done it cos we run our own web-servers and db-servers. But I'll see what I can find out.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Jan 2006
Location: Its the internet... i am everywhere lol
Posts: 274
Reputation: f1 fan is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 10
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: built in login and createuser wizard but for a remote SQL database? how to change?

  #3  
May 3rd, 2007
To use a remote SQL Server you need to add the settings to your web config. At the top you need to add the connection string
	<connectionStrings>
		<add name="MyConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=servername;Initial Catalog=database;UID=username;pwd=password"/>
	</connectionStrings>

Then you need to change authentication mode to forms and add the providers.
		<authentication mode="Forms">
			<forms name="appname" loginUrl="login.aspx" protection="All" path="/" timeout="60"/>
		</authentication>
		<membership defaultProvider="MySqlLoginProvider">
			<providers>
				<add name="MySqlLoginProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MyConnectionString" applicationName="appname" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" passwordAttemptWindow="30" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"/>
			</providers>
		</membership>
		<roleManager defaultProvider="MyRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPRoles" cookiePath="/" cookieTimeout="60" cookieSlidingExpiration="true" cookieProtection="All">
			<providers>
				<add name="MyRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MyConnectionString" applicationName="appname"/>
			</providers>
		</roleManager>

Now when you go to the admin site you will see the new providers and test them
Reply With Quote  
Join Date: Mar 2008
Posts: 3
Reputation: webdev8183 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webdev8183 webdev8183 is offline Offline
Newbie Poster

Question Re: built in login and createuser wizard but for a remote SQL database? how to change?

  #4  
Mar 5th, 2008
Originally Posted by f1 fan View Post
To use a remote SQL Server you need to add the settings to your web config. At the top you need to add the connection string
	<connectionStrings>
		<add name="MyConnectionString" providerName="System.Data.SqlClient" connectionString="Data Source=servername;Initial Catalog=database;UID=username;pwd=password"/>
	</connectionStrings>

Then you need to change authentication mode to forms and add the providers.
		<authentication mode="Forms">
			<forms name="appname" loginUrl="login.aspx" protection="All" path="/" timeout="60"/>
		</authentication>
		<membership defaultProvider="MySqlLoginProvider">
			<providers>
				<add name="MySqlLoginProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MyConnectionString" applicationName="appname" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="3" passwordAttemptWindow="30" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"/>
			</providers>
		</membership>
		<roleManager defaultProvider="MyRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPRoles" cookiePath="/" cookieTimeout="60" cookieSlidingExpiration="true" cookieProtection="All">
			<providers>
				<add name="MyRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="MyConnectionString" applicationName="appname"/>
			</providers>
		</roleManager>

Now when you go to the admin site you will see the new providers and test them

I tried this but its still not working for me, I get the following errors , can anyone assist.
 System.Configuration.ConfigurationErrorsException: The 'system.web' start tag on line 16 does not match the end tag of 'authentication'. Line 57, position 9. (C:\WebSite1\web.config line 57) ---> System.Xml.XmlException: The 'system.web' start tag on line 16 does not match the end tag of 'authentication'. Line 57, position 9. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag) at System.Xml.XmlTextReaderImpl.ParseEndElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlTextReader.Read() at System.Configuration.XmlUtil.CopySection() at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, OverrideModeSetting overrideMode, Boolean skipInChildApps) at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, OverrideModeSetting overrideMode, Boolean skipInChildApps) at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil) at System.Configuration.BaseConfigurationRecord.InitConfigFromFile() --- End of inner exception stack trace --- at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle) at System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel, ConfigurationFileMap fileMap, String path, String site, String locationSubPath, String server, String userName, String password, IntPtr userToken) at System.Web.Configuration.WebConfigurationManager.OpenMappedWebConfiguration(WebConfigurationFileMap fileMap, String path) at System.Web.Administration.WebAdminPage.OpenWebConfiguration(String path, String appPhysPath, Boolean getWebConfigForSubDir) at System.Web.Administration.WebAdminPage.OpenWebConfiguration(String path, Boolean getWebConfigForSubDir) at System.Web.Administration.WebAdminPage.VerifyAppValid() 
Reply With Quote  
Join Date: Mar 2008
Posts: 1
Reputation: jayakumarjesus is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jayakumarjesus jayakumarjesus is offline Offline
Newbie Poster

Re: built in login and createuser wizard but for a remote SQL database? how to change?

  #5  
Mar 12th, 2008
I would like to create login page in asp.net for a project by using web site adminstration tool. Please send any procedure to do it and if any code is for this please send this
Thanking you
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 8:48 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC