Configuration :: Put MembershipProvider, ProfileProvider And RoleProvider In One Single External Config File?
Oct 5, 2010How can I put MembershipProvider, ProfileProvider and RoleProvider in one single external config file?
View 1 RepliesHow can I put MembershipProvider, ProfileProvider and RoleProvider in one single external config file?
View 1 Replieshow can i access 2 external config files from web.config file.
i have done it for one external file like this in webconfig:
<appSettings file="........">
Now how can i access the second external config file from same webconfig.
I trying to understand how a server farm would use MembershipProvider / RoleProvider. If I have a million users, I do not want to have multiple copies of the MembershipProvider / RoleProvider database. I would like to have one set of machines used for login but then redirect users to other machines in the server farm depending applications the users decide to use. However, once they are redirected to the new machine, I do not want the user to have to relogin. I want the credentials and role information to be available.
Does anyone know how MembershipProvider / RoleProvider is configured for this type architecture?
I have created a custom MembershipProvider and RoleProvider which communications with some existing business logic. The issue I have is that the user login in my business logic requires 3 arguments (group id, user id, and password) and the MembershipProvider and RoleProvider I implemented just use 1 or 2 arguments (username, password). Right now I append my group id and user id together and pass it as the username then parse it in the implemented methods. Is there a better way to do this?
Note, I can handle the login fine because I can call my own ValidateUser method. The main issue is when the implemented methods are called from other things like the RoleProvider.GetRolesForUser(username) method when I use the AuthorizeAttribute.
[Code]....
[Code]....
I was wondering if it is possible to use a WCF Dataservice as the MemberShipProvider for a forms auth application. I have written code for a provider (below), but I do not know what to do as far as a connection string, or any other web.config properties.
Here is the code for my provider, anytime it says Odbc that is because I based this off of the custom Odbc provider on the msdn site. The only ACTUAL references to any odbc connection are in the comments:
[Code]....
Does Forms Authentication require that cookies be enabled to use MembershipProvider and RoleProvider? If so, can anyone tell me the minimum security level I need to tel clients to use.
View 2 RepliesSay for my ASP.NET application, I have implemented my custom RoleProvider by using my existing Users table on my Oracle 11g database. Then, for my Membership Provider, can I still use the AspNetSqlMembershipProvider that comes with the .NET framework and uses SQL Server?
View 4 RepliesI have written an assembly (DLL) containing two classes, MyMembershipProvider and MyRoleProvider, which are derived from MembershipProvider and RoleProvider, respectively. I have implemented most but not all of the abstract methods; the remaining ones all throw a NotImplementedException. I have signed the assembly and added a reference to it in my web-site project, where the relevant web.config sections look like this:
[Code]....
When I fire up the site, however, I get the following error:
Configuration Error
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message:
Exception has been thrown by the target of an invocation.
The error message points to the <add /> tag in the <roleManager /> section: if I take that out, however (enabled="false"), it comes back again as soon as I try to log-in to the site (this time pointing to the membership section). I have verified that is recognising the classes by changing the name in the "type" attribute (to something that doesn't exist), at which point it throws a different error. Therefore I'm presuming there's a problem with my assembly code somewhere; but how can I find out where? I have debug=true in the web.config and also compiled the assembly with Debug options, but no clues.
I have to duplicate some settings (like connection string) between a web.config file that a WCF host uses and a web.config file that a web client uses.
In the interest of not duplicating, can I have both the web.configs read from a separate xml file? The two web.configs can be entirely in different solutions/projects so I guess this is not possible, but wanted to get other's opinion.
PS: I do understand I can use a database to store all the config settings.
How to protect our web.config file from external access.
I mean some sort of password protection.
I am getting an error with my custom RoleProvider (based on System.Web.Security.RoleProvider) initializing in my ASP.NET application. The error is: "Description: An error occurred during the processing of a configuration file required to service this request." I see this below error happening on a Windows 2003 server with .NET 3.5 SP1. I have not seen it on Windows 2008 servers, and have not seen the error when the ASP.NET application was built under .NET 2.0 (running on this same server). Any thoughts on the nature of the error?
Classification: UNCLASSIFIED
Caveats: NONE
Server Error in '/Assist' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: FrameworkRoleProvider_Initialize
Source Error:
Line 122: <clear />
Line 123: <add
Line 124: type="Grb.Security.FrameworkRoleProvider"
Line 125: applicationName="MyApplication1" />
Line 126: </providers>
Source File: D:inetpubAssistweb.config Line: 124
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
HERE'S THE INITIALIZING FUNCTION FOR THE ROLE PROVIDER:
Public Overloads Overrides Sub Initialize(ByVal name As String, ByVal config As System.Collections.Specialized.NameValueCollection)
Try
If config Is Nothing Then
Throw New ArgumentNullException("config")
End If
If String.IsNullOrEmpty(name) Then
name = Me.GetType().BaseType.Name
End If
If String.IsNullOrEmpty(config(DescriptionKey)) Then
config.Remove(DescriptionKey)
config.Add(DescriptionKey, SR.GetString(SR.RoleSqlProvider_description))
End If
MyBase.Initialize(name, config)
' Get the configuration settings
Dim configurationSettings1 As Grb.Framework.Business.ConfigurationSettings = Grb.Framework.Business.FrameworkConfiguration.GetConfiguration()
' Load the DomainManager
Dim dataManager1 As New Grb.Framework.Data.Main(Nothing, configurationSettings1.FrameworkSchema, configurationSettings1.AssistSchema, _
configurationSettings1.ConnectionString, configurationSettings1.ProviderInvariantName, _
configurationSettings1.EnablePerformanceLogging, System.Web.HttpContext.Current.Request.PhysicalApplicationPath)
' Load the DomainManager
Dim frameworkDomainManager As Grb.Framework.Business.DomainManager = New Grb.Framework.Business.DomainManager(dataManager1, -1, -1)
m_ProductDomainManager = New Grb.PlugIn.Assist.Business.DomainManager(dataManager1, frameworkDomainManager)
m_ApplicationName = config(ApplicationNameKey)
If String.IsNullOrEmpty(m_ApplicationName) Then
m_ApplicationName = SecUtility.GetDefaultAppName()
End If
If m_ApplicationName.Length > 256 Then
Throw New System.Configuration.Provider.ProviderException(SR.GetString(SR.Provider_application_name_too_long))
End If
config.Remove(ApplicationNameKey)
If config.Count > 0 Then
Dim attribUnrecognized As String = config.GetKey(0)
If Not String.IsNullOrEmpty(attribUnrecognized) Then
Throw New System.Configuration.Provider.ProviderException(SR.GetString(SR.Provider_unrecognized_attribute, attribUnrecognized))
End If
End If
Catch ex As Exception
Throw New Grb.Framework.Core.Exceptions.FrameworkBusinessException( _
Resources.ExceptionMessages.FrameworkRoleProvider_Initialize, ex)
End Try
End Sub
WEB.CONFIG:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"
/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"
/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"
/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<connectionStrings>
<!-- example: <add name="ConnectionString" value="Data Source=MyServer;User Id=GRB_WEB_USER_10;Password=temp;" providerName="Oracle.DataAccess.Client" /> -->
<add name="FrameworkConnection" connectionString="Data Source=;User Id=;Password=;" providerName="Oracle.DataAccess.Client"/>
</connectionStrings>
<appSettings>
<!-- example: <add key="FrameworkSchema" value="GRB_FRAMEWORK_2" /> -->
<add key="FrameworkSchema" value="" />
<!-- example: <add key="AssistSchema" value="GRB_ASSIST_2" /> -->
<add key="AssistSchema" value="" />
<add key="FromEmail" value="support@myagency.com" />
<add key="PasswordCreateEmailSubject" value="GRB Assist Create Password" />
<add key="PasswordEstablishOrChangeEmailSubject" value="GRB Assist Established or Changed Password" />
<add key="PasswordForgotEmailSubject" value="GRB Assist Forgot Password" />
<add key="Timeout" value="60" />
<add key="RequiresSsl" value="False"/>
<!-- Email digital signing Pfx (certificate) -->
<add key="EmailSigningSignUsingCertificateFromPersonalStore" value="False" />
<add key="EmailSigningPfxFilePathAndName" value="" />
<add key="EmailSigningPfxPassword" value="" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
<pages>
<controls>
<add tagPrefix="aspajax" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</controls>
<tagMapping>
</tagMapping>
</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 defaultLanguage="vb" debug="false">
<assemblies>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
<!-- 1 GB maxRequestLength -->
<httpRuntime maxRequestLength="1048576" />
<sessionState mode="InProc" timeout="60" />
<!-- note: Set authentication timeout >= session timeout (session timeout will clear authentication timeout upon session_start) -->
<!-- note: <forms name="xxxx" value must be unique for each "forms authenticated" web application run on an IIS web server -->
<!-- note: For a more secure system, set requiresSSL="true" (and install/setup an SSL key on the web site) -->
<authentication mode="Forms">
<forms loginUrl="TimedOut.aspx" slidingExpiration="false" requireSSL="false" timeout="60"/>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<membership defaultProvider="FrameworkMembershipProvider1" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="FrameworkMembershipProvider1"
type="Grb.Security.FrameworkMembershipProvider"
applicationName="Product1"
passwordRetrieval="false"
passwordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredNonalphanumericCharacters="0"
minRequiredPasswordLength="4"
passwordStrengthRegularExpression="^[a-zA-Z0-9]+$"
passwordStrengthFailedMessage="The password must be only alpha-numeric characters."
frameworkDomainName="Master"
maximumInvalidPasswordAttempts="3"
maximumInvalidPasswordAttemptLockoutMinutes="30"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="FrameworkRoleProvider1">
<providers>
<clear />
<add name="FrameworkRoleProvider1"
type="Grb.Security.FrameworkRoleProvider"
applicationName="MyApplication1" />
</providers>
</roleManager>
</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>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.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=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Portal.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Login.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="PasswordChange.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="PasswordForgot.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="PasswordEntry.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<!-- Give ControlLoader.aspx full access and let it check session/authentication validation.
The rational is that if a user is "timed-out" and presses a button to load a control into ControlLoader, the ControlLoader validation will catch this condition and tell the parent page to reload (so the Login page doesn't appear in the modal-dialog).
-->
<location path="ControlLoader.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Documents/AccountServices.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Documents/TermsOfUse.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="SystemAlertService.asmx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.net>
<mailSettings>
<smtp from="[URL]">
<!-- example: host="[URL]-->
<network
host=""
port="25"
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
</configuration>
I want to maintain different user authorization lists for different environments. I know that connectionstrings can be broken out in an external file with configSource, but how would I do this for the following?
<authorization>
<allow users="someuser1"/>
<allow users="someuser2"/>
<allow users="someuser3"/>
<deny users="*"/>
</authorization>
I'm preparing to deploy a ASP.NET web application. The target server has already a previous version of my web application with parameters specified on the web.config file.
In the new version of this web application, the web.config file contains new sections I would like they appear into the target web.config file on the server.
However I can't find the way to merge the new web.config sections into the existing web.config file ?
Does I have to do it programmatically, or is there a tool to merge the both files during installation ? (I'm using Web Setup Project).
I am developing web applicaiton. I want to read web.config in App.config file. I have appSettings and connectionStrings in web.config. How to read that?
View 10 RepliesI currently cache everything possible on my site (images, JS, CSS). There is only one JS file that I need to be loaded fresh every single time. How do I omit just one file from caching, using web.config, whilst leaving everything else cached?
Note that I tried another link here, and it didn't seem to stop the caching of my file: How do I disable caching of an individual file in IIS 7 using weserver config settings
We are experiencing some strange behaviour on one of our ASP.NET web servers (Windows 2003 64-bit). After some activity, two third-party controls are unable to run correctly. One is log4net (it does not write error messages out) and the other is a menu control (it displays eval message instead of picking up its license). The one common thread is that both controls pick up their config from external config files (linked to from web.config).
Just wondering if anyone has any thoughts on this or experienced this in any way. Is it related to file/folder rights? The server has been running fine for a while and just started exhibiting this behaviour. Perhaps it occurs around the time the worker processes are recycled.
I have built an ASP.NET (.NET v4) application in VS 2010. It is working just fine. But when I try to create deployment package (so I can deploy it in our test IIS 7.5 Server), it gives me error like this,
Error 1 Could not open Source file: Could not find file 'C:11-2 estobjDebugCSAutoParameterize ransformedWeb.config'. 0 0 test
Thing is in past, I had deployed the SAME application using the SAME method.
I'm using .resx file in my project. when i build the application the satellite assemblies are created under bin directory. If i add this dll in other application then these satellite assemblies are added in other application bin directory. I want to add only the dll reference, not any other dlls so how to create a single dll for this scenario?
View 1 Repliesi'm working in vs2010 and am just about ready to deploy a Web sitei've read elsewhere that i should be able to add a web.release.config file and should be able to select it for the release buildso i added a web.release.config file right below my web.config file but it doesn't show up in my Configuration Manager
View 1 Repliesin my xslt i am at present hardcoding an value. <td><tr>HI</tr></td> Can i get this 'HI' instead from app settings in my web.config file?
View 3 RepliesI faced the following problem. Once I have completed my whole application it genereate dll file for each aspx file in bin folder. Now in published state the application faced some run time error in specific page. now I want to only republished that page generating error. while Visual Studio don't let me compile the individual page. can some one guide me in this regards.
View 1 RepliesI want to publish my website from the development machine to QA server. Do I need to create a new web.config file which has the new data connection strings and copy it on the QA server or is there a better way of doing this, so that every time I publish modified files, the web.config does not get overwritten.
View 9 Replieswhat are the different sections in web.config file?
View 1 RepliesI am designing a web application for Leave Application of our faculties. There is a form in my website which represent the existing paper-back leave application form. Users(faculties) have to fill-up this web form and after validation an email will be send to the email address of our principal/hod. I hope that email address(s) will be provided to our group members. Now I want to know that what will be the required configuration of the web.config file? I found this blog ScottGu's Blog. Here the given configuration is:
[Code]....
But I think this is not acceptable for my project as the smtp from="test@foo.com", userName, password are unknown to me. So what should I do. Am I able to understand my requirement to you?
how can i encrpt database password and store to Visual Studio's connectionString areaalso, i would like to know how can i set all config in config file and how the program can read.