<?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>blog.dervalp.com &#187; Add new tag</title>
	<atom:link href="http://blog.dervalp.com/tag/add-new-tag/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dervalp.com</link>
	<description>Think before Programming (Public learning)</description>
	<lastBuildDate>Sat, 20 Mar 2010 22:22:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Kiwi MVC.NET : Authentication Layer, introduction Part2</title>
		<link>http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/</link>
		<comments>http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/#comments</comments>
		<pubDate>Thu, 14 May 2009 12:47:20 +0000</pubDate>
		<dc:creator>dervalp</dc:creator>
				<category><![CDATA[Kiwi MVC]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Membership]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Provider]]></category>
		<category><![CDATA[Role]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://blog.dervalp.com/?p=100</guid>
		<description><![CDATA[I know it is a bit weird to begin a CMS application by implementing a Membership system but the simple raison why I start up with that is because I needed for my work (as you can see in my previous post ).
Too often, I saw developers rewriting their own membership system in place to [...]]]></description>
			<content:encoded><![CDATA[<p>I know it is a bit weird to begin a CMS application by implementing a Membership system but the simple raison why I start up with that is because I needed for my work (as you can see in <a href="http://blog.dervalp.com/2009/05/12/azam-adam-abracanabram-%C2%BB-is-harry-potter-a-dotnet-developer-part-1-membershipprovider/" target="_blank">my previous post</a> ).</p>
<p>Too often, I saw developers rewriting their own membership system in place to use what the framework (no matter which one) can offer.</p>
<h2><span id="more-100"></span></h2>
<p>It is the main raison why I choose to implement the ASP.NET Membership system in Kiwi.  It has a lot of interesting functionalities but on the other hand it is like riding a big monster.  Thus, I am going to use it as pluggableas as I can do.</p>
<h2>The User Object :</h2>
<p>Today, creating an object called User is being strange. If you want to choose the OOP way, a user is often too generic. If you developed an e-commerce, you will certainly choose customer in place of user. But a customer and an admin can login in your system, so are-you going to create two objects? One called “customer” and the other called “vip”? That sounds weird no?</p>
<p>Here is my point of view. A membership system is for me an additional layer you can implement (or not). It is not the hearth of your application; it is just a security layer. That why I am going to use it without any &#8220;User&#8221; object.  I saw 3 mains services that a Membership system could offer :</p>
<ul>
<li> authentication (who is this guy)</li>
<li>personalization (what the guy like)</li>
<li>authorization (what the guy can do)</li>
</ul>
<h2>Sql membership :</h2>
<p>We saw in one of <a href="http://blog.dervalp.com/2009/05/12/azam-adam-abracanabram-%C2%BB-is-harry-potter-a-dotnet-developer-part-1-membershipprovider/" target="_blank">my previous post</a> that ASP.NET has 2 differents way to manage the membership layer. There we saw the active directory membership provider. Today, we will use the SqlMembershipProvider.</p>
<p>First, to use Sql membership you need a sql server with a database up. Therefore, I went to the Microsoft website to download Sql Server 2008 express and I installed it.</p>
<p>I create an empty db called Kiwi.</p>
<p>Then in the folder &#8220;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727&#8243;, I execute the aspnet_regsql.exe and provide the right information to allow the connection to the database. Finish the setup and let’s take a look on the database called Kiwi:</p>
<p><img class="alignnone size-full wp-image-105" title="kiwi_part2_1" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_1.jpg" alt="kiwi_part2_1" width="413" height="488" /></p>
<p>Now, I configure the Webconfig to use the SqlMemberShipProvider with my application.<br />
Here is the connection string I added to my webconfig file:</p>
<p><img class="alignnone size-full wp-image-107" title="kiwi_part2_2" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_2.jpg" alt="kiwi_part2_2" width="604" height="100" /></p>
<p>To test if everything works well,</p>
<p>Change the name of the connection string under membership to make the connection with your db.</p>
<p><img class="alignnone size-full wp-image-108" title="kiwi_part2_3" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_3.jpg" alt="kiwi_part2_3" width="590" height="336" /></p>
<p>Now make a test, go to the ASP.NET configuration when you are on your MVC.WEB in your website.</p>
<p><img class="alignnone size-full wp-image-109" title="kiwi_part2_4" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_4.jpg" alt="kiwi_part2_4" width="243" height="445" /></p>
<p>You will enter in the Web Site Administation Tool :</p>
<p><img class="alignnone size-full wp-image-110" title="kiwi_part2_5" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_5.jpg" alt="kiwi_part2_5" width="628" height="381" /></p>
<p>If you click on Security you will access a page where you can manage the users, the roles and the access rules.<br />
For the test, click on the “Create User” link and create one :<br />
<img class="alignnone size-full wp-image-111" title="kiwi_part2_6" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_6.jpg" alt="kiwi_part2_6" width="570" height="308" /></p>
<p>Create the user and go to the server explorer on your Visual Studio. If you do not have a connection to your db yet in server explorer, add it.</p>
<p><img class="alignnone size-full wp-image-112" title="kiwi_part2_7" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_7.jpg" alt="kiwi_part2_7" width="347" height="508" /></p>
<p>On the table aspnet_Users, right-click on Show Table Data and you will see the user you created above.</p>
<p><img class="alignnone size-full wp-image-113" title="kiwi_part2_8" src="http://blog.dervalp.com/wp-content/uploads/2009/05/kiwi_part2_8.jpg" alt="kiwi_part2_8" width="628" height="62" /></p>
<p>Cool stuff isn’t it ?<br />
Now we have a db called Kiwi with some tables created by the .NET framwork.<br />
The web application can connect to the Kiwi database and you are now able to manage user with the ASP.NET administation tools.</p>
<p>In the next post : I will begin to code with the Test driven design approach. I will create the different layer we need in our repository to make the authentication working.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d100').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d100" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;title=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;title=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;title=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;title=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;title=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2+@+http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/&amp;t=Kiwi+MVC.NET+%3A+Authentication+Layer%2C+introduction+Part2" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://blog.dervalp.com/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d100').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d100').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://blog.dervalp.com/2009/05/14/kiwi-mvc-authentication-layer-introduction-part2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
