|
Hello J Snyman as can be seen in the web.config of my asp.net 2.0 application that I am doing in VisualStudio2005 I have a 2 providers SqlSiteMapProvider which is the standard for use with authentication and security based on MemberShipProvider and another to use only the MySqlSiteMapProvider who also uses Roles of the MemberShipProvider the standard SQLServer as can be seen below in web.config
<appSettings/>
<connectionStrings>
<add name="MembershipConnection" connectionString="Data Source=mydatasource;Initial Catalog=mydb;User ID=sa;Password=mypass" providerName="System.Data.SqlClient"/>
<add connectionString="server=mysqlserver;database=mybd;user id=myid;pwd=mypass" name="SimpleProviderConnectionString" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<system.web>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="SqlProvider" type="System.Web.Security.SqlMemberShipProvider"
connectionStringName="MembershipConnection"/>
</providers>
</membership>
<!-- INÍCIO CONFIGS MYSQLSITEMAPPROVIDER -->
<siteMap defaultProvider="siteMapProvider" enabled="true">
<providers>
<clear />
<add name="siteMapProvider"
type="Simple.Providers.MySQL.MysqlSiteMapProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="myapp"
description="MySQL site map provider"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<authentication mode="Forms">
</authentication>
What you need to know is how to properly configure so that the two providers one for each state are recognized and work properly in my webapplication Project and how to ensure that the roles created Membership in the SQL are recognized in MySqlSiteMapProvider too.
If you can help me now thank you
Translated from Portuguese to English by Google
LADEF
|
|
|
|
|
I have been using the Membership provider for some time. Now I have added som 400 users, and I find (confirmed on 3 different servers) that it takes 10 seconds or more from the time you press the "Login"-button until you are actually logged in. Same thing when you press "log out".
Has anyone got any ideas on how to improve speeed? Code-optimazation, database-optimization...
|
|
|
|
|
I would start by looking at the SQL queries that are used when a user logs in/out.
Another solution might be to migrate to the MySQL/Net Connector that has Membership providers built in.
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
Do you have any experience with MySQL/Net Connector? Last time I looked, it was in som beta-test-stadium?
|
|
|
|
|
Unfortunately not.
I have read on the MySql site that the connector is now in productions release and stable.
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
OK thx. Meanwhile I fond a bug of my own, having nothing to do with your connector. So I'll stick with that for now.
|
|
|
|
|
When I set passwordFormat="Encrypted" under the membership tag of my web.config file, I am receiving the following error when I click on the security link of the ASP.NET Configuration tool:
Hashed or Encrypted passwords are not supported with auto-generated keys
The same happens when I set passwordFormat="Hashed"
Any help on this would be highly appreciated!
|
|
|
|
|
Dear Jacques, many thanks for your excellent post. I am a real newbie to asp, having spent 25 years in 4GLs, and I have spent the last 3 days trying to find out how to use MySQL database as a membership database, so I can use the CreateUserWizard in my aspx files. I have finally, with your help, get as far as the whole application running without errors in the web.config file, however now when I go to the createuserwizard page, I get the error below. I can't for the life of me work out where this is going wrong. I have reduced it to just the rolemanager and membership bit in the web.config, and have changed the cookiepath to ~/cookies. I have added <@ Import Namespace="Simple.Providers.MySQL" %> into my master page, and your dll into the bin directory of my application.
Where am I going wrong???? Any help would be greatly appreciated to stop me going completely bananas on this (should be simple) issue!
Kind Regards, Ross Holland
Stack Trace:
[InvalidOperationException: Failed to map the path '/'.]
System.Web.Configuration.ProcessHostConfigUtils.MapPathActual(String siteName, VirtualPath path) +223
System.Web.Configuration.ProcessHostMapPath.MapPathCaching(String siteID, VirtualPath path) +611
System.Web.Configuration.ProcessHostMapPath.GetPathConfigFilenameWorker(String siteID, VirtualPath path, String& directory, String& baseName) +14
System.Web.Configuration.ProcessHostMapPath.System.Web.Configuration.IConfigMapPath.GetPathConfigFilename(String siteID, String path, String& directory, String& baseName) +38
System.Web.Configuration.HostingPreferredMapPath.GetPathConfigFilename(String siteID, String path, String& directory, String& baseName) +77
System.Web.Configuration.WebConfigurationHost.GetStreamName(String configPath) +162
System.Configuration.Internal.DelegatingConfigHost.GetStreamName(String configPath) +10
System.Configuration.BaseConfigurationRecord.InitConfigFromFile() +265
[ConfigurationErrorsException: An error occurred loading a configuration file: Failed to map the path '/'.]
System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) +111
System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) +41
System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) +413
System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams) +30
System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle) +934
System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel, ConfigurationFileMap fileMap, String path, String site, String locationSubPath, String server, String userName, String password, IntPtr userToken) +71
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(String path) +23
Simple.Providers.MySQL.MysqlMembershipProvider.Initialize(String name, NameValueCollection config) +1429
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +579
System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) +115
System.Web.Security.Membership.Initialize() +1593
System.Web.UI.WebControls.LoginUtil.GetProvider(String providerName) +33
System.Web.UI.WebControls.CreateUserWizard.get_QuestionAndAnswerRequired() +90
System.Web.UI.WebControls.CreateUserWizard.UpdateValidators() +1134
System.Web.UI.WebControls.CreateUserWizard.CreateChildControls() +32
System.Web.UI.Control.EnsureChildControls() +97
System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +100
System.Web.UI.Control.InitRecursive(Control namingContainer) +345
System.Web.UI.Control.InitRecursive(Control namingContainer) +196
System.Web.UI.Control.InitRecursive(Control namingContainer) +196
System.Web.UI.Control.InitRecursive(Control namingContainer) +196
System.Web.UI.Control.InitRecursive(Control namingContainer) +196
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7915
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +223
System.Web.UI.Page.ProcessRequest() +85
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +20
System.Web.UI.Page.ProcessRequest(HttpContext context) +110
ASP.register_aspx.ProcessRequest(HttpContext context) +30
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +441
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +65
|
|
|
|
|
Hi Ross...
Could you please post your web.config file? I would like to get the complete picture before trying to decipher the error.
Regards
Jacques Snyman
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
Dear Jacques, hope this helps, Cheers Ross
<configuration>
<connectionStrings>
<add name="MyDB" connectionString="driver={MySQL ODBC 3.51 Driver};database=userid;option=16387;pwd=password;port=0;server=server-ip;uid=userid"
providerName="System.Data.Odbc" />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
<authentication mode="Forms">
<forms loginUrl="login.aspx" />
</authentication>
<roleManager defaultProvider="roleProvider" enabled="true"
cacheRolesInCookie="false" cookieName=".ASPROLES"
cookieTimeout="7200" cookiePath="~/cookies" cookieRequireSSL="false"
cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<clear />
<add name="roleProvider"
type="Simple.Providers.MySQL.MysqlRoleProvider"
connectionStringName="MyDB"
applicationName="myapp.org.uk"
description="MySQL role provider"/>
</providers>
</roleManager>
<membership defaultProvider="membershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="membershipProvider"
type="Simple.Providers.MySQL.MysqlMembershipProvider"
connectionStringName="MyDB"
applicationName="myapp.org.uk"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Encrypted"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
description="MySQL membership provider"/>
</providers>
</membership>
</system.web>
<location path="MembersOnly">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
</configuration>
|
|
|
|
|
The only issue I can see is that the tilde (~) might not be parsed by the server because it is in the config file. Have you tried to use a relative path (eg "/cookies/")?
Does the cookies directory exist?
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
Hello J Snyman,
Compliments for the article is very interesting
I use Visual Studio 2008 c#, mysql 5 and ADO.NET Driver for MySQL (Connector/NET)
I am trying to work your suite, but I have difficulties.
In Web Site Administration Tool
-------------------------------------------------------------------
An exception occurred communicating with the data source.
Action: GetAllUsers
Exception: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato.
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at Simple.Providers.MySQL.MysqlMembershipProvider.GetAllUsers(Int32 pageIndex, Int32 pageSize, Int32& totalRecords)
Per ulteriori informazioni, consultare la Guida in linea e supporto tecnico
-------------------------------------------------------------------
In login.aspx
-------------------------------------------------------------------
System.InvalidOperationException non è stata gestita dal codice utente
Message="The ConnectionString property has not been initialized."
Source="System.Data"
StackTrace:
at System.Data.Odbc.OdbcConnection.PermissionDemand()
at System.Data.Odbc.OdbcConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at Simple.Providers.MySQL.MysqlMembershipProvider.ValidateUser(String username, String password)
at _Default.Login1_Authenticate(Object sender, AuthenticateEventArgs e) in c:\Inetpub\wwwroot\sito\Default.aspx.cs:line 34
at System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
-------------------------------------------------------------------
Thanks
|
|
|
|
|
The example above uses the MySQL ODBC driver, not the .NET driver.
|
|
|
|
|
As the Order Alphabetically by MySqlSiteMapProvider us children, or qdo I add an item on the menu I would like the Parent Title him he was Sorted Alphabetically or is not
If pd help me now thank you
<div class="ForumSig">LADEF</div>
|
|
|
|
|
Hello J. Snimman at least managed to put the already My Menu with MySQLSITEMAPPROVIDER using MYSQLCONNECTOR 5.0 in the air, now I would like to know if there any article or link that based on his or Article code of example that nôs teaches itself as customize the menus based on user profiles, or would be accessible to each user a menu or menus for it if there is any link please ask if I could pass. Sincerely and now thank
LADEF
|
|
|
|
|
But I wonder if taking advantage vc have an article based on this same driver MySQLCONNECTOR 5.0 on the ASPNETDB such as HTTP LINK
Http://forums.mysql.com/read.php?60, 119245.119245
Or based on the structure of the tables MYSQLSITEMAPPROVIDER as harness would get them into FORMS AUTHENTICATIONS with Login and Password with rules set for cd Profile usuário.Se pd me spend a HTTP on some kind of your article so I am already grateful
LADEF
|
|
|
|
|
How would the WEBCONFIG, based on the article of the Voloda with MySqlConnector since Article Voloda do not have the WebConfig or what would have to change in relation to your WebConfig for use with MySQLCONNECTOR 5.0 is pd help me now thank you
LADEF
|
|
|
|
|
I would like to know if is to help me take some questions about the article if possible
Doubts 1) The article is for the driver - MySql Odbc driver to adapt the code for use with the driver MYSQL5.0 CONNECTOR
Doubts 2) What do I use as given in the Table of ApplicationName sitemap of db DBStructure.sql that it provides to download the article fz
Doubts 3) In WEBConfig what to say about that
/ *! Please replace the App Your Name) (instances with a valid
Application Name. The application name should not contain
Any spaces or special characters. ! * /
If pd help me now thank you
LADEF
|
|
|
|
|
Hi...
Please try to be more clear on what you want. Punctuation might help as well. I just can't understand what you want!
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
OK here are the answers
1) Using the driver MYSQLCONNECTOR 5.0 in this article what I have to change in the code in webconfig?
2) What data or information which I place on the field in the table ApplicationName sitemap of bd coming downloading article
And
3) What I have to ask where kj says
/ *! Please replace the App Your Name) (instances with a valid
Application Name. The application name should not contain
Any spaces or special characters. ! * /
At. Luiz - Brazil - Itatiba-SP - I am using google translation, I do not understand much English, but if pd help me now thank you
LADEF
|
|
|
|
|
|
2 and 3) Replace all instances of "Your Name App" in the web.config with a short name for its implementation. The short name will also be used under sitemap.
I could understand, but in the case the name of its implementation would be short NAME OF THE ARCHIVE PROJECT eg.
On the code below that name would be short MeuMenuDinamico?
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
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;
Namespace MeuMenuDinamico
(
Public partial class _Default: System.Web.UI.Page
(
Protected void Page_Load (object sender, EventArgs e)
(
)
Protected void Menu1_MenuItemClick (object sender, and MenuEventArgs)
(
Switch (e.Item.Value)
(
Case "Products":
SiteMapDataSource2.StartingNodeUrl = "Default.aspx? Hardware node =";
Return;
Case "Services":
SiteMapDataSource2.StartingNodeUrl = "Default.aspx? Consulting node =";
Return;
Case "Support":
SiteMapDataSource2.StartingNodeUrl = "Default.aspx? Node = drivers";
Return;
)
)
)
)
If pd help me now thank and in the case of Article of Voloda if the link would get me the same move if possible
LADEF
|
|
|
|
|
2 & 3) Yes... That is correct...
What is pd?
I don't understand your last line... "If pd help me now thank and in the case of Article of Voloda if the link would get me the same move if possible"
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|
|
I do the LINK TO ARTICLE VOLODA SE POSSIVEL this is what I say in the last line
And name of the application is MeuMenuDinamico correct?
LADEF
|
|
|
|
|
And name of the application is MeuMenuDinamico correct? - YES!
I do the LINK TO ARTICLE VOLODA SE POSSIVEL this is what I say in the last line - You do the link? What do you mean, DO the link?
"I'm about as expert as a palsy victim performing brain surgery with a pipe wrench."
Check out my site at JacquesSnyman.co.za
** Remember: An article is only as good as the votes it gets **
|
|
|
|