|
I have created the MySql table and also edited the web.config as mentioned above.
but when I try to run the 'newregister.aspx' file which contains createuserwizard control
the following error is displayed
-----------------------------------------------------------------------------------------
Failed to map the path '/'.
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: Failed to map the path '/'.
Stack Trace:
[InvalidOperationException: Failed to map the path '/'.]
System.Web.Configuration.ProcessHostConfigUtils.MapPathActual(String siteName, VirtualPath path) +253
System.Web.Configuration.ProcessHostMapPath.MapPathCaching(String siteID, VirtualPath path) +669
System.Web.Configuration.ProcessHostMapPath.GetPathConfigFilenameWorker(String siteID, VirtualPath path, String& directory, String& baseName) +19
System.Web.Configuration.ProcessHostMapPath.System.Web.Configuration.IConfigMapPath.GetPathConfigFilename(String siteID, String path, String& directory, String& baseName) +37
System.Web.Configuration.HostingPreferredMapPath.GetPathConfigFilename(String siteID, String path, String& directory, String& baseName) +75
System.Web.Configuration.WebConfigurationHost.GetStreamName(String configPath) +8845430
System.Configuration.Internal.DelegatingConfigHost.GetStreamName(String configPath) +13
System.Configuration.BaseConfigurationRecord.InitConfigFromFile() +154
[ConfigurationErrorsException: An error occurred loading a configuration file: Failed to map the path '/'.]
System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) +650948
System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) +31
System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) +356
System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams) +29
System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle) +775
System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl(WebLevel webLevel, ConfigurationFileMap fileMap, String path, String site, String locationSubPath, String server, String userName, String password, IntPtr userToken) +84
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(String path) +36
Simple.Providers.MySQL.MysqlMembershipProvider.Initialize(String name, NameValueCollection config) in C:\ONRAC\CSPROJ\MySqlProv\MysqlMembershipProvider.cs:163
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +592
System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) +126
System.Web.Security.Membership.Initialize() +1569
System.Web.UI.WebControls.LoginUtil.GetProvider(String providerName) +35
System.Web.UI.WebControls.CreateUserWizard.get_QuestionAndAnswerRequired() +93
System.Web.UI.WebControls.CreateUserWizard.UpdateValidators() +580
System.Web.UI.WebControls.CreateUserWizard.CreateChildControls() +33
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +90
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6741
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.new_user_aspx.ProcessRequest(HttpContext context) +37
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
-----------------------------------------------------------------------------------------
Is there something wrong the applicationpath.I have set the applicationpath="project"
or
Is there something wrong with the reference of the .DLL file.
I have placed the "ccmMyProvClass" folder inside the '\Visual Studio 2008\WebSites' folder ,which contains 'project' folder in which there is newregister.aspx file.
or
Is something else missing
Please help me solve this problem,I am new in asp.net any suggestions will be helpful.
|
|
|
|
|
How do I recognize the Simple.Providers.MySql Connector MySqlConnector version 6.1.2 as the latest one is this link that has tried to remove the reference to MySql.Data version and place it now and do rebuild the DLL to generate it gives error
The error it gives is
Error 1 The type 'System.Xml.Serialization.IXmlSerializable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\ComponentesDLL\MySqlSiteMapProvider\Simple.Providers.MySQL_Source\Simple.Providers.MySQL\RawDBQuery.cs 9 31 Simple.Providers.MySQL
Here the link of the current version of the connector
<a href="http://dev.mysql.com/downloads/connector/net/6.1.html" target="blank">MySqlConnector 6.1.2</a>
I'm using VS2005 to try to rebuild but not working there would be some link with the SimpleProvider because of MySqlSiteMap with the new version of the connector?
I am in the look and I thank you
LADEF
|
|
|
|
|
This works fine, as long as you only want to move one part around the screen. Let me explain I set up two columns with more than one webpart on the right hand side column, and moved webparts from the right to the left. When I move the first webpart, it moves fine, however when I move a second, the first webpart is replaced by the webpart I am moving. Before, It's my code is uttered I ran the same code with the SQL form authentication and the web parts move find. If you can help I would appreciate your comments.
Regards,
Martin
|
|
|
|
|
Onrac you could you explain why when I use a control-type sitemappath in currentnode, I explain what's happening
well let me explain you better then
My SiteMapProvider comes from below as MySqlSiteMapProvider
<!-- 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>
<!-- FIM CONFIGS MYSQL SITEMAPPROVIDER -->
When the url it in my database in the field url MySqlSiteMapProvider is like this
id, myapp, 'Atibaia-SP.', 'shops - Atibaia-SP.', 'shops.aspx?subsessao=books&cidade=atibaia&uf=sp', '', parentid
it shows SiteMapPath in control of my application correctly or
Home :shops : books : Atibaia-SP.
Now when the data comes from my database of mysqlsitemapprovider that way
id, myapp, 'São Paulo-SP.', 'shops - São Paulo-SP.', 'shops.aspx?subsessao=books&cidade=são paulo&uf=sp', '', parentid
or
id, myapp, 'Jundiaí-SP.', 'shops - Jundia-SP.', 'shops.aspx?subsessao=books&cidade=´jundiaí&uf=sp', '', parentid
it just shows me this result in the control mode of execution in SiteMapPath
Home : shops
if you can help me now because I need to thank the currentnode, finally on all nodes that the accented characters with spaces and mapped by MySqlSiteMapProvider appear with accents and spaces in control sitemappath
LADEF
|
|
|
|
|
Hello onrac 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 am using MySQL membership provider for my web applications.
And I want to use same membership database for more than one application.
It works fine when storing information. Created users in each application is stored related to that application's name.
However when logging in, any valid user from any application can log in even that username does not belong to that application.
My question arise at this point. Is there a way that mysql membership provider can handle this situation by its own?
Any help is appreciated..
Oncel Umut TURER
|
|
|
|
|
It is nice article No Doubt.
but anyone can help me how i integrate this to the actual asp website files.
|
|
|
|
|
I have changed the names of the following tables
table users by aspnet_Users
table roles by aspnet_Roles
table usersinroles by aspnet_UsersInRolesñ
Actually run the management of roles and users, but I don't get to test the provider after the new names of table.
If somebody knows the answer I agree his answer.
Thanks
|
|
|
|
|
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
you can help me now thank you
LADEF
|
|
|
|
|
Hello ONRAC 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
|
|
|
|
|
Based on your article and did correct the webconfig below for my application which is now working properly but the Tool Administration of Site, in the error happens Safety Guide
There is a problem with data storage selected. You may be caused by credential or Filename invalid, or by inadequate level of permission. He may also is occurring because the resource management functions are not allowed. Click on the button below to be redirected to the page where you can choose a new data storage.
The message below can help diagnose the problem: Hashed or Encrypted passwords are not supported with self-generated keys. (C: \ Inetpub \ wwwroot \ TesteMySqlSiteMapProvider \ TesteMySqlSiteMapProvider \ web.config line 56)
As the line 56 of webconfig being as
Type = "Simple.Providers.MySQL.MysqlMembershipProvider"
Below the full WebConfig to better analyse and I look forward to your response in my doubts will be possible at. Luiz - Brazil-SP.
My WebConfig
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<connectionStrings>
<add connectionString="server=myserver;database=mydatabase;user id=myid;pwd=mypass" name="SimpleProviderConnectionString" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<!-- INÍCIO CONFIGS MYSQLSITEMAPPROVIDER -->
<siteMap defaultProvider="siteMapProvider" enabled="true">
<providers>
<clear />
<add name="siteMapProvider"
type="Simple.Providers.MySQL.MysqlSiteMapProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
description="MySQL site map provider"
securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<roleManager defaultProvider="roleProvider" enabled="true"
cacheRolesInCookie="false" cookieName=".ASPROLES"
cookieTimeout="7200" cookiePath="/" cookieRequireSSL="false"
cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<clear />
<add name="roleProvider"
type="Simple.Providers.MySQL.MysqlRoleProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
description="MySQL role provider"/>
</providers>
</roleManager>
<membership defaultProvider="membershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="membershipProvider"
type="Simple.Providers.MySQL.MysqlMembershipProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Encrypted"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
description="MySQL membership provider"/>
</providers>
</membership>
<profile defaultProvider="profileProvider"
automaticSaveEnabled="true">
<providers>
<clear />
<add name="profileProvider"
type="Simple.Providers.MySQL.MysqlProfileProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
description="MySQL Profile Provider"/>
</providers>
<properties>
<clear />
<!--
Add any needed attributes for profiles here.
eg. <add name="Theme" type="System.String"
defaultValue="Default"/>
-->
</properties>
</profile>
<webParts>
<personalization defaultProvider="personalizationProvider">
<providers>
<clear/>
<add name="personalizationProvider"
type="Simple.Providers.MySQL.
MysqlPersonalizationProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
description="MySQL Personalization Provider"
/>
</providers>
</personalization>
</webParts>
<!-- FIM CONFIGS MYSQL SITEMAPPROVIDER -->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--
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="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
</configuration>
LADEF
|
|
|
|
|
In WebConfig between the lines of Article 85 and 95 as below
<personalization defaultProvider="personalizationProvider">
<providers>
<clear />
<add name="personalizationProvider"
type="Simple.Providers.MySQL.
MysqlPersonalizationProvider" connectionStringName=
"{Your Connection String Name}" applicationName="
{Your App Name}"
description="MySQL Personalization Provider/>
</providers>
</personalization>
In my project apparently think that the correct way below only that I would like to know if you correct the way in which fix
<personalization defaultProvider="personalizationProvider">
<providers>
<clear/>
<add name="personalizationProvider"
type="Simple.Providers.MySQL.MysqlPersonalizationProvider"
connectionStringName="SimpleProviderConnectionString"
applicationName="TesteMySqlSiteMapProvider"
description="MySQL Personalization Provider"
/>
</providers>
</personalization>
If he can guide me now thank you
LADEF
|
|
|
|
|
As in the place of MySqlConnector 5.1.2 I could use MySqlConnector 5.0 The reason my hosting provider has only installed the drivers of MySQLCONNECTOR 5.0
LADEF
|
|
|
|
|
Thanks for doing this, but...
1) Your code formatting is, for lack of a better term, CRAP. If you're going to essentially duplicate someone else's code, at least go through it to the point that it looks decent.
2) You need to update the code to eliminate the deprecated MySqlDataType.Datetime references.
3) Both your version and the original contain an error in the web.config stuff. The very last item has the ending quote in the wrong place. It seems to me that one of you guys (you or the guy that posted the original article) would have picked up on it by now.
4) You need to go back through all the source code and add proper intellisense-compatible comments to all of the classes, properties and functions.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks very much for some extremely useful code – for all the standard membership stuff everything is working perfectly.
However I’ve just started looking at WebParts and it appears that the personalization code is still using ODBC. Do you have a newer version that has been converted to use the MySQLConnection instead?
|
|
|
|
|
using System;
using System.Configuration.Provider;
using System.Security.Permissions;
using System.Web;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Text;
using System.IO;
using System.Data;
using MySql.Data.MySqlClient;
namespace Simple.Providers.MySQL
{
public class MysqlPersonalizationProvider : PersonalizationProvider
{
private string m_ApplicationName;
public override string ApplicationName
{
get { return m_ApplicationName; }
set { m_ApplicationName = value; }
}
private string m_ConnectionStringName;
public string ConnectionStringName
{
get { return m_ConnectionStringName; }
set { m_ConnectionStringName = value; }
}
public override void Initialize(string name,
NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException("config");
if (String.IsNullOrEmpty(name))
name = "SimpleMySqlPersonalizationProvider";
if (string.IsNullOrEmpty(config["description"]))
{
config.Remove("description");
config.Add("description",
"Simple MySql personalization provider");
}
base.Initialize(name, config);
if (string.IsNullOrEmpty(config["connectionStringName"]))
{
throw new ProviderException
("ConnectionStringName property has not been specified");
}
else
{
m_ConnectionStringName = config["connectionStringName"];
config.Remove("connectionStringName");
}
if (string.IsNullOrEmpty(config["applicationName"]))
{
throw new ProviderException
("applicationName property has not been specified");
}
else
{
m_ApplicationName = config["applicationName"];
config.Remove("applicationName");
}
if (config.Count > 0)
{
string attr = config.GetKey(0);
if (!String.IsNullOrEmpty(attr))
throw new ProviderException
("Unrecognized attribute: " + attr);
}
}
protected override void LoadPersonalizationBlobs
(WebPartManager webPartManager, string path, string userName,
ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{
sharedDataBlob = null;
userDataBlob = null;
object sharedBlobDataObject = null;
object userBlobDataObject = null;
string sSQLShared = null;
string sSQLUser = null;
try
{
sSQLUser = "SELECT `personalizationblob` FROM `personalization`" + Environment.NewLine +
"WHERE `username` = '" + userName + "' AND " + Environment.NewLine +
"`path` = '" + path + "' AND " + Environment.NewLine +
"`applicationname` = '" + m_ApplicationName + "';";
sSQLShared = "SELECT `personalizationblob` FROM `personalization`" + Environment.NewLine +
"WHERE `username` IS NULL AND " + Environment.NewLine +
"`path` = '" + path + "' AND " + Environment.NewLine +
"`applicationname` = '" + m_ApplicationName + "';";
sharedBlobDataObject = RawDBQuery.ExecuteScalarOnDB(sSQLShared, System.Configuration.ConfigurationManager.ConnectionStrings[m_ConnectionStringName].ToString());
userBlobDataObject = RawDBQuery.ExecuteScalarOnDB(sSQLUser, System.Configuration.ConfigurationManager.ConnectionStrings[m_ConnectionStringName].ToString());
if (sharedBlobDataObject != null)
sharedDataBlob =
(byte[])sharedBlobDataObject;
if (userBlobDataObject != null)
userDataBlob =
(byte[])userBlobDataObject;
}
catch (FileNotFoundException)
{
}
finally
{
sSQLUser = null;
sSQLShared = null;
}
}
protected override void ResetPersonalizationBlob
(WebPartManager webPartManager, string path, string userName)
{
string sSQL = null;
try
{
sSQL = "DELETE FROM `personalization` WHERE `username` = '"+userName+"' AND `path` = '"+path+"' AND `applicationname` = '"+m_ApplicationName+"';";
RawDBQuery.ExecuteNonQueryOnDB(sSQL, System.Configuration.ConfigurationManager.ConnectionStrings[m_ConnectionStringName].ToString());
}
catch (System.Data.Odbc.OdbcException) { }
}
protected override void SavePersonalizationBlob
(WebPartManager webPartManager, string path, string userName,
byte[] dataBlob)
{
MySqlCommand updateCommand = null;
MySqlConnection updateConnection = null;
string sSQL = null;
try
{
sSQL = "SELECT COUNT(`username`) FROM `personalization` WHERE `username` = '"+userName+"' AND `path` = '"+path+"' and `applicationname` = '"+m_ApplicationName+"';";
updateConnection = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[m_ConnectionStringName].ToString());
if (int.Parse(RawDBQuery.ExecuteScalarOnDB(sSQL, System.Configuration.ConfigurationManager.ConnectionStrings[m_ConnectionStringName].ToString()).ToString()) > 0)
{
sSQL = "UPDATE `personalization` SET `personalizationblob` = ?personalizationblob WHERE `username` = ?username AND `applicationname` = ?applicationname AND `path` = ?path;";
updateCommand = new MySqlCommand(sSQL,updateConnection);
updateCommand.Parameters.Clear();
updateCommand.Parameters.Add(new MySqlParameter("?personalizationblob",dataBlob));
updateCommand.Parameters.Add(new MySqlParameter("?username", userName));
updateCommand.Parameters.Add(new MySqlParameter("?applicationname", m_ApplicationName));
updateCommand.Parameters.Add(new MySqlParameter("?path", path));
}
else
{
sSQL = "INSERT INTO `personalization` (`username`,`path`,`applicationname`,`personalizationblob`) VALUES (?username, ?path, ?applicationname, ?personalizationblob);";
updateCommand = new MySqlCommand(sSQL, updateConnection);
updateCommand.Parameters.Clear();
updateCommand.Parameters.Add(new MySqlParameter("?username", userName));
updateCommand.Parameters.Add(new MySqlParameter("?path", path));
updateCommand.Parameters.Add(new MySqlParameter("?applicationname", m_ApplicationName));
updateCommand.Parameters.Add(new MySqlParameter("?personalizationblob", dataBlob));
}
updateConnection.Open();
updateCommand.ExecuteNonQuery();
}
finally
{
if (updateConnection != null)
if (updateConnection.State != System.Data.ConnectionState.Closed)
updateConnection.Close();
else
updateConnection.Dispose();
updateConnection = null;
if (updateCommand != null) updateCommand.Dispose();
updateCommand = null;
sSQL = null;
}
}
public override PersonalizationStateInfoCollection FindState
(PersonalizationScope scope, PersonalizationStateQuery query,
int pageIndex, int pageSize, out int totalRecords)
{
throw new NotSupportedException();
}
public override int GetCountOfState(PersonalizationScope scope,
PersonalizationStateQuery query)
{
throw new NotSupportedException();
}
public override int ResetState(PersonalizationScope scope,
string[] paths, string[] usernames)
{
throw new NotSupportedException();
}
public override int ResetUserState(string path,
DateTime userInactiveSinceDate)
{
throw new NotSupportedException();
}
}
}
|
|
|
|
|
It would be nice to see some .aspx examples of how you integrate this to the actual asp website files.
|
|
|
|
|
The tables names should be Like this
Personalization
Profiles
Roles
Sitemap
Users
UsersInRoles
Casesensitive
ibyasmo
|
|
|
|
|
Hey man nice Tutorial, i have one question though please >!? well maybe 2 i'm relatively new to ASP 2
and have used your tutorial to setup my sites security / provider.
i followed it to a T yet when ever i try to login i get the server error as below:
****************************************************************************
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +678
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +114
System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName) +80
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions) +115
System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName) +7
System.Configuration.Internal.DelegatingConfigHost.OpenStreamForRead(String streamName) +10
System.Configuration.UpdateConfigHost.OpenStreamForRead(String streamName) +42
System.Configuration.BaseConfigurationRecord.InitConfigFromFile() +443
*******************************************************************************
so i'm guessing i need to set my app some security in the web.config ?? can you help please ?
it's externally hosted the site i have setup the ASP 2 feature on my host & i connect to mysql server also hosted by same provider.
connection string is this:
<connectionstrings>
<add name="SimpleProviderconnectionstring" connectionstring="server=(my servers ip here);database=SimpleProviders;user id=SimpleProviders;pwd=(my passwrd)" providername="MySql.Data.MySqlClient">
and my membership string:
<membership defaultprovider="membershipProvider"
="" userisonlinetimewindow="15">
<providers>
<clear>
<add name="membershipProvider"
="" type="Simple.Providers.MySQL.MysqlMembershipProvider" connectionstringname="SimpleProviderConnectionString" applicationname="site registry" requiresquestionandanswer="true" requiresuniqueemail="false" passwordformat="Encrypted" minrequiredpasswordlength="6" minrequirednonalphanumericcharacters="0" description="MySQL membership provider">
any help appreciated
regards
Kane
" i'm mediocre on ASP & .NET but i'll help if & where i can."
|
|
|
|
|
I think there is a security configuration : <machineKey> tag; this is my web.config (part):
<!-- partial web config
<machineKey validationKey="60D041931C3DB23072745CD298DCADD2906F0EADEBE7F0E9E28CFA7176F7FD685540A5501292D046940A5F6351C7185849F38441897C10BD59536C3C8991E9B9" decryptionKey="C342DA197897E627C58D98D825F09063943B208EB988B1D3" validation="SHA1"/>
<siteMap defaultProvider="siteMapProvider" enabled="true">
<providers>
<clear/>
<add name="siteMapProvider" type="Simple.Providers.MySQL.MysqlSiteMapProvider" connectionStringName="SimpleProviderConnectionString" applicationName="OnracMembership" description="MySQL site map provider" securityTrimmingEnabled="true"/>
</providers>
</siteMap>
<roleManager defaultProvider="roleProvider" enabled="true" cacheRolesInCookie="false" cookieName=".ASPROLES" cookieTimeout="7200" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<clear/>
<add name="roleProvider" type="Simple.Providers.MySQL.MysqlRoleProvider" connectionStringName="SimpleProviderConnectionString" applicationName="OnracMembership" description="MySQL role provider"/>
</providers>
</roleManager>
Copy the <machineKey /> and incorporate with your own.
-->
-- modified at 23:30 Monday 17th September, 2007<pre></pre>
|
|
|
|
|
Man the machine key worked greatbut that gave me another total error.. Anyhow i have totally rebuilt a new project as i worried about the whole project. I now have re-installed my connector.msi and with the new project i get :
*********************************************************
Error in application:
Configuration Error
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=5.0.8.1, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 88: <compilation debug="true">
Line 89: <assemblies>
Line 90: <add assembly="MySql.Data, Version=5.0.8.1, Culture=neutral, PublicKeyToken=C5687FC88969C44D">
Line 92:
********************************************************
i think it's because the HOST itself is not have installed the connector .NET drivers or application ?!?!
please advise
cheers
" i'm mediocre on ASP & .NET but i'll help if & where i can."
|
|
|
|
|
Great effort, but I am confused. Aren't membership and role providers already incorporated into the the latest connectors version 5.1.2 (see http://dev.mysql.com/downloads/connector/net/5.1.html)?
I appreciate any clarifications.
Cheers,
Adrian
Host your ASP.NET 2.0, .NET 3.0 and Ajax 1.0 applications.
|
|
|
|
|
Yup; but this one includes sitemap and personalization provider.
|
|
|
|
|
but need to reformat the article ):
|
|
|
|
|
good sum up there are already some articles for this situation.
|
|
|
|
|