<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Emad Alashi&#039;s Blog &#187; machine.config</title>
	<atom:link href="http://www.emadashi.com/index.php/tag/machineconfig/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emadashi.com</link>
	<description></description>
	<lastBuildDate>Sun, 15 Jan 2012 10:05:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>default ASP.NET Membership provider on different database</title>
		<link>http://www.emadashi.com/index.php/2009/01/default-aspnet-membership-provider-on-different-database/</link>
		<comments>http://www.emadashi.com/index.php/2009/01/default-aspnet-membership-provider-on-different-database/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 23:27:31 +0000</pubDate>
		<dc:creator>Emad Alashi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[machine.config]]></category>
		<category><![CDATA[membership provider]]></category>
		<category><![CDATA[web.config]]></category>

		<guid isPermaLink="false">http://eashi.wordpress.com/2009/01/26/default-aspnet-membership-provider-on-different-database/</guid>
		<description><![CDATA[Every ASP.NET developer should already know about the Membership Provider that ships with ASP.NET 2.0. Configuring it is as easy as opening Visual Studio &#62; select the Web project file &#62; navigate to the Project menu item &#62; and select &#8220;ASP.NET Configuration&#8221;. Follow the wizard and you are up and running now.
But the problem with [...]]]></description>
			<content:encoded><![CDATA[<p>Every ASP.NET developer should already know about the <a href="http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx">Membership Provider</a> that ships with ASP.NET 2.0. Configuring it is as easy as opening Visual Studio &gt; select the Web project file &gt; navigate to the <em>Project</em> menu item &gt; and select &#8220;<em>ASP.NET Configuration&#8221;. </em>Follow the wizard and you are up and running now.</p>
<p>But the problem with this approach is that it will build it&#8217;s OWN database in the App_Data folder and create the required tables there. Wouldn&#8217;t most of us have their own databases to work with? ok then, if you want the <strong>defualt</strong> ASP.NET Membership Provide (AspNetSqlMembershipProvider) to work on <strong>YOUR</strong> database do the following:</p>
<ol>
<li>Navigate to the folder: &#8220;<strong>C:\Windows\Microsoft.NET\Framework\v2.0.50727</strong>&#8221; and run the &#8220;<strong>aspnet_regsql.exe</strong>&#8221; file, follow the wizard (it&#8217;s pretty easy, see the images below)<br />
<br />
<a href="http://eashi.files.wordpress.com/2009/01/step1.jpg"><img style="border-width:0;" src="http://eashi.files.wordpress.com/2009/01/step1-thumb.jpg" border="0" alt="Step1" width="558" height="429" /></a><a href="http://eashi.files.wordpress.com/2009/01/step2.jpg"><img style="border-width:0;" src="http://eashi.files.wordpress.com/2009/01/step2-thumb.jpg" border="0" alt="Step2" width="558" height="429" /></a><br />
<br />
This step will create the Membership and Profile Provider tables necessary; if you are lucky you will see many dbo.aspnet_<em>something</em> tables.</li>
<li>Now we need to tell the website which Provider it should use for this functionality, and to which database it should connect to; the default configuration information that drives the default behavior of the default Provider resides in the Machine.config (<em>C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG</em>), which explains why you can&#8217;t find the configuration information on YOUR web.config even after you finish using the ASP.NET Configuration mini-website.<br />
The best thing to do is to copy that configuration information from the machine.config to your website web.config in order to override its behavior to our desired one, for more information about configuration files and configuration hierarchy read <a href="http://msdn.microsoft.com/en-us/library/ms178685.aspx">this</a>.</p>
<div style="font-size:10pt;background:#f2ebe3;color:black;font-family:courier new;">
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">membership</span><span style="color:blue;"> </span><span style="color:red;">defaultProvider</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">AspNetSqlMembershipProvider</span>&#8220;<span style="color:blue;"> &gt;</span></p>
<p style="margin:0;"><span style="color:blue;">      &lt;</span><span style="color:#a31515;">providers</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">        &lt;</span><span style="color:#a31515;background-color:#ffff00;">clear</span><span style="color:blue;">/&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">        &lt;</span><span style="color:#a31515;">add</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">AspNetSqlMembershipProvider</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</span>&#8220;<span style="color:red;background-color:#ffff00;"> connectionStringName</span><span style="color:blue;background-color:#ffff00;">=&#8221;</span><span style="color:blue;background-color:#ffff00;">BunianConnectionString&#8221;</span><span style="color:blue;"> </span><span style="color:red;">enablePasswordRetrieval</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">false</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">enablePasswordReset</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">requiresQuestionAndAnswer</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">applicationName</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">/</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">requiresUniqueEmail</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">false</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">passwordFormat</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Hashed</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">maxInvalidPasswordAttempts</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">5</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">minRequiredPasswordLength</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">7</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">minRequiredNonalphanumericCharacters</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">1</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">passwordAttemptWindow</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">10</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">passwordStrengthRegularExpression</span><span style="color:blue;">=</span>&#8220;&#8221;<span style="color:blue;">/&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">      &lt;/</span><span style="color:#a31515;">providers</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">    &lt;/</span><span style="color:#a31515;">membership</span><span style="color:blue;">&gt;</span></p>
</div>
<p>Note that highlighted changes:</p>
<ol>
<li>clear any previous configuration of the AspNetSqlMebershipProvider (machine.config) which if not moved will give you an error of already being configured</li>
<li>changing the connection string to mach a connectionstring name that you use to connect to your database in general</li>
</ol>
</li>
</ol>
<p>This way you will have the default Membership Provider running on your database for your website; if you use the mini-site for the ASP.NET Configuration now and create new users, you will find them created in your database.</p>
<p>Note that some resources say that you can change the database from the ASP.NET Configuration but I couldn&#8217;t find it there.</p>
<p><em>Disclaimer: use the above on your own responsibility <img src='http://www.emadashi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.emadashi.com/index.php/2009/01/default-aspnet-membership-provider-on-different-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

