Solved

Remote Membership

Posted on 2006-11-21
4
377 Views
Last Modified: 2008-01-09
The help of an Expert is needed. As you will see in the code provided below, from my web.config file, the membership database is an ASPNETDB.MDF file in the local App_Data folder. I'd like an Expert to show me what this page would look like if it were pointing to a remote SQL Server 2005 database instead. Please, no hyperlinks. I can do a google search myself. If you know how to do this, please show me; else, no worries, I'll figure it out myself.
Many kind thanks in advance!

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
      <system.web>
            <authentication mode="Forms"/>
            <membership defaultProvider="CustomizedProvider">
                  <providers>
                        <add name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" applicationName="/" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0"/>
                  </providers>
            </membership>
            <compilation debug="true"/></system.web>
</configuration>
0
Comment
Question by:John Account
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:kraffay
ID: 17988574
It would look the same, except the connectionStringName would say something like "RemoteSQLServer" and you would have a connection string node

      <connectionStrings>
            <add name="RemoteSQLServer" connectionString ="server=MyRemoteServer;uid=;pwd=;Trusted_Connection=yes;database=cs" />
      </connectionStrings>
0
 

Author Comment

by:John Account
ID: 17989629
So I added this below, but get this error: Unrecognized element 'connectionStrings'.
<membership defaultProvider="CustomizedProvider">
                  <providers>
                        <add name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="RemoteSQLServer" applicationName="/" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0"/>
                  </providers>
      <connectionStrings>
      <add name="RemoteSQLServer" connectionString="Data Source=blahblah.com;Persist Security Info=True;User ID=admin;Password=blahblah;Trusted_Connection=yes;database=cs" />
      </connectionStrings>
            </membership>
0
 
LVL 9

Accepted Solution

by:
kraffay earned 500 total points
ID: 17989669
The web.config has a specific structure.  Here is a sample of one from CommunityServer (you'll need to put your connection string in the proper node, under the configuation node.):

<configuration>

      <connectionStrings>
            <add name="SiteSqlServer" connectionString ="server=.\SQLExpress;uid=;pwd=;Trusted_Connection=yes;database=cs" />
      </connectionStrings>

      <system.web>

            <!-- Standard Application Settings -->
            <compilation defaultLanguage="c#" debug="false" />

            <trace enabled="false" requestLimit="40" localOnly="true"/>
            <sessionState mode="Off" />

            <!-- Permit detailed errors to be displayed for remote clients -->
            <customErrors mode="RemoteOnly" defaultRedirect="~/error.htm">
                  <error statusCode="404" redirect="~/error-notfound.aspx" />
            </customErrors>


            <!-- START - CommunityServer specific application settings here -->
            <httpModules>
                  <add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components" />
                  <!-- <add name="CSReporting" type="CommunityServer.Reporting.ReportingHttpModule, CommunityServer.Reporting" /> -->
            </httpModules>

            <httpHandlers>
                  <add verb="GET" path="Utility/redirect.aspx" type="CommunityServer.Components.Redirect, CommunityServer.Components" />
                  <add verb="GET" path="aggbug.aspx" type="CommunityServer.Components.HttpHandler.AggBugHandler, CommunityServer.Components" />
                  <add verb="GET" path="avatar.aspx" type="CommunityServer.Components.HttpHandler.AvatarHttpHandler, CommunityServer.Components" />
                  <add verb="GET" path="vcard.aspx" type="CommunityServer.Components.HttpHandler.VCardHttpHandler, CommunityServer.Components" />
                  <add verb="GET" path="r.ashx" type="CommunityServer.Components.HttpHandler.TinyUrlHttpHandler, CommunityServer.Components" />
            </httpHandlers>

            <!--
            authentication :
                  To use Windows Authentication, you must turn off Anonymous authentication in IIS
                  or IIS will never pass the user credentials to the forums.  

                  To enable Windows Authentication, simply comment out the forms authentication section
                  below and uncomment the Windows Authentication stuff.

                  To use the CookieAuthentication add-on module, set the authentication mode to "None" and
                  comment out the forms element.
            -->
            <authentication mode="Forms">
                  <forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="login.aspx" slidingExpiration="true" />
            </authentication>

            <membership userIsOnlineTimeWindow="15" defaultProvider="CommunityServerSqlProvider" >
                  <providers>
                        <clear />
                        <add
                              name="CommunityServerSqlProvider"                  
                              type="CommunityServer.ASPNet20MemberRole.CSMembershipProvider, CommunityServer.ASPNet20MemberRole"
                              connectionStringName="SiteSqlServer"
                              enablePasswordRetrieval="false"
                              enablePasswordReset="true"
                              requiresQuestionAndAnswer="false"
                              requiresUniqueEmail="true"
                              passwordFormat="Hashed"
                              applicationName="dev"
                              description="Stores and retrieves membership data from the local Microsoft SQL Server database"
                              maxInvalidPasswordAttempts = "999"
                              passwordAttemptWindow = "999"
                              minRequiredPasswordLength = "6"
                              minRequiredNonalphanumericCharacters = "0"
                        />
                  </providers>
            </membership>

            <roleManager defaultProvider="CommunityServerSqlProvider" enabled="true"
                  cacheRolesInCookie="true" cookieName=".CSRoles" cookieTimeout="60000"
                  cookiePath="/"  cookieRequireSSL="false" cookieSlidingExpiration="true"
                  createPersistentCookie="true" cookieProtection="All" maxCachedResults="1000" >
                  <providers>
                        <clear />
                        <add
                              name="CommunityServerSqlProvider"
                              type="CommunityServer.ASPNet20MemberRole.CSRoleProvider, CommunityServer.ASPNet20MemberRole"
                              connectionStringName="SiteSqlServer"
                              applicationName="dev"
                              description="Stores and retrieves roles data from the local Microsoft SQL Server database"
                        />
                  </providers>
            </roleManager>

            <profile defaultProvider="CommunityServerSqlProvider" enabled="true" >
                  <providers>
                        <clear />
                        <add  
                              name="CommunityServerSqlProvider"  
                              type="CommunityServer.ASPNet20MemberRole.CSProfileProvider, CommunityServer.ASPNet20MemberRole"
                              connectionStringName="SiteSqlServer"
                              applicationName="dev"
                                  description="Stores and retrieves profile data from the local Microsoft SQL Server database"
                        />
                  </providers>

                  <properties>
                        <add name = "commonName" type = "string" />
                        <add name = "birthdate" type = "DateTime" />
                        <add name = "gender" type = "int" defaultValue = "0" />
                        <add name = "dateFormat" type = "string" defaultValue="MM-dd-yyyy" />
                        <add name = "publicEmail" type = "string" />
                        <add name = "language" type = "string" />
                        <add name = "webAddress" type = "string" />
                        <add name = "webLog" type = "string" />
                        <add name = "webGallery" type = "string" />
                        <add name = "signature" type = "string" />
                        <add name = "signatureFormatted" type = "string" />
                        <add name = "location" type = "string" />
                        <add name = "occupation" type = "string" />
                        <add name = "interests" type = "string" />
                        <add name = "msnIM" type = "string" />
                        <add name = "yahooIM" type = "string" />
                        <add name = "aolIM" type = "string" />
                        <add name = "icqIM" type = "string" />
                        <add name = "enablePostPreviewPopup" type = "System.Boolean" defaultValue = "false" />
                        <add name = "enableEmoticons" type = "System.Boolean" defaultValue = "true" />
                        <add name = "timezone" type = "System.Double" defaultValue="0" />
                        <add name = "fontsize" type = "int" defaultValue = "0" />
                        <add name = "bio" type = "string" />
                  </properties>
            </profile>

            <!--
            ========================
            Anonymous Identification
            ========================
            anonymousIdentification configuration:
                  enabled="[true|false]"                            Feature is enabled?
                      cookieName=".ASPXANONYMOUS"                       Cookie Name
                      cookieTimeout="100000"                            Cookie Timeout in minutes
                      cookiePath="/"                                    Cookie Path
                      cookieRequireSSL="[true|false]"                   Set Secure bit in Cookie
                      cookieSlidingExpiration="[true|false]"            Reissue expiring cookies?
                      cookieProtection="[None|Validation|Encryption|All]"    How to protect cookies from being read/tampered
                      domain="[domain]"                                 Enables output of the "domain" cookie attribute set to the specified value
              -->
            <anonymousIdentification
            enabled="false"
            cookieName=".ASPXANONYMOUS"
            cookieTimeout="100000"
                        cookiePath="/"
            cookieRequireSSL="false"
            cookieSlidingExpiration="true"
                        cookieProtection="None" domain="" />
      
      </system.web>

      <location path="EditPost.aspx">
            <system.web>
                  <authorization>
                        <deny users="?" />
                  </authorization>
            </system.web>
      </location>

      <location path="PrivateMessage.aspx">
            <system.web>
                  <authorization>
                        <deny users="?" />
                  </authorization>
            </system.web>
      </location>

      <location path="Download.aspx">
            <system.web>
                  <authorization>
                        <deny users="?" />
                  </authorization>
            </system.web>
      </location>

      <location path="License.aspx">
            <system.web>
                  <authorization>
                        <deny users="?" />
                  </authorization>
            </system.web>
      </location>

</configuration>
0
 

Author Comment

by:John Account
ID: 17989929
Whoah...that was a bit overwhelming at first, but I did manage to sort through all the excess, and finally get something working after repeated trial-and-error. Hopefully, soon I'll be ready to learn all that other stuff; just too busy now for it all, though. So thanks, kraffay, for coming through for me. Your help was greatly appreciated.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Split in Javascript 5 39
Signal R -send data to client: only if they are allowed to see it ? 1 49
Delete HTML table rows 12 27
Footer for each row on Gridview 2 19
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question