<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>hiddensanctum chronicles</title>
	<atom:link href="http://hiddensanctum.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hiddensanctum.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 15 Dec 2010 23:08:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hiddensanctum.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>hiddensanctum chronicles</title>
		<link>http://hiddensanctum.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hiddensanctum.wordpress.com/osd.xml" title="hiddensanctum chronicles" />
	<atom:link rel='hub' href='http://hiddensanctum.wordpress.com/?pushpress=hub'/>
		<item>
		<title>General update.</title>
		<link>http://hiddensanctum.wordpress.com/2010/12/14/general-update/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/12/14/general-update/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 04:04:36 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=59</guid>
		<description><![CDATA[Today, I finished up my Master&#8217;s degree.  I&#8217;ll be travelling at the end of this month/beginning of January, but expect this to pick back up in the new year.  I&#8217;ve been working on a little bit of coding, but I&#8217;ll cover that soon. For now, check out my girlfriend&#8217;s new blog.  She&#8217;s the rabid bibliophile [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=59&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today, I finished up my Master&#8217;s degree.  I&#8217;ll be travelling at the end of this month/beginning of January, but expect this to pick back up in the new year.  I&#8217;ve been working on a little bit of coding, but I&#8217;ll cover that soon.</p>
<p>For now, check out <a title="Bess In Boots" href="http://bessinboots.wordpress.com/" target="_blank">my girlfriend&#8217;s new blog</a>.  She&#8217;s the rabid bibliophile that is the inspiration for this whole project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=59&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/12/14/general-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
		<item>
		<title>Membership</title>
		<link>http://hiddensanctum.wordpress.com/2010/08/28/membership/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/08/28/membership/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 16:16:22 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[Context]]></category>
		<category><![CDATA[Membership Provider]]></category>
		<category><![CDATA[Providers]]></category>
		<category><![CDATA[Users]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=50</guid>
		<description><![CDATA[Hello, sparse readers!  It&#8217;s been a summer, but I&#8217;m back!  This time, I want to talk a little bit about what I&#8217;ve done with Membership so far.  (In case you&#8217;re wondering &#8211; yes, this is still a catch-up post rather than new development.) In order to setup your SQL Membership provider in your web.config, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=50&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hello, sparse readers!  It&#8217;s been a summer, but I&#8217;m back!  This time, I want to talk a little bit about what I&#8217;ve done with Membership so far.  (In case you&#8217;re wondering &#8211; yes, this is still a catch-up post rather than new development.)</p>
<p>In order to setup your SQL Membership provider in your web.config, you first need to provide a connection string to the database holding your Membership information.  Since, for this application, all providers reside in the same database, I have added a generic Providers connection string:</p>
<pre>&lt;add name="Providers" connectionString="Data Source=DEVLT01\SQLEXPRESS; Initial Catalog=Providers; Integrated Security=SSPI;" /&gt;</pre>
<p>Now, under <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">system.web</span>, we want to add the <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">membership</span> node.  This node contains Membership providers (in this case, just one) and specified which of these providers is the default:</p>
<pre>&lt;membership defaultProvider="SqlMembershipProvider"&gt;
	&lt;providers&gt;
	  &lt;add name="SqlMembershipProvider"
		   connectionStringName="Providers"
		   applicationName="hiddensanctum"
		   type="System.Web.Security.SqlMembershipProvider"
		   maxInvalidPasswordAttempts="5"
		   minRequiredNonalphanumericCharacters="0"
		   minRequiredPasswordLength="1"
		   passwordFormat="Hashed"
		   requiresQuestionAndAnswer="false"
		   requiresUniqueEmail="false" /&gt;
	&lt;/providers&gt;
&lt;/membership&gt;</pre>
<p>The values I have in here will probably change as I determine the policies I will be using for passwords.  One thing I know is that I will want to remove a limit on the maximum number of invalid password attempts and instead add a <a title="CAPTCHA" href="http://en.wikipedia.org/wiki/CAPTCHA" target="_blank">CAPTCHA</a> after a few invalid login attempts, much like <a title="Gmail" href="http://gmail.com" target="_blank">Gmail</a> does.  Another thing I know is that I don&#8217;t want passwords to be retrievable, so I set passwordFormat to Hashed.  Users will be able to reset their passwords, but they will not be able to recover them.</p>
<p>The final thing to do to setup your Membership provider is to set your application to use the provider as opposed to the default Windows authentication.  This can be done by changing your authentication mode to Forms:</p>
<pre>&lt;authentication mode="Forms" /&gt;</pre>
<p>Now you&#8217;re set to actually use your Membership provider!</p>
<p>My usage begins in my PageBase class.  As I mentioned in <a title="MasterPages" href="http://hiddensanctum.wordpress.com/2010/04/28/masterpages/" target="_blank">my post about MasterPages</a>, each page in this web application will derive from my PageBase class, which will provide universal, generic functionality.  First, let me show you the properties that I&#8217;m creating, then I will discuss them:</p>
<pre>public bool UserIsLoggedIn
{
	get
	{
		return Context.User.Identity.IsAuthenticated;
	}
}

public bool CurrentUserIsTargetUser
{
	get
	{
		return string.IsNullOrEmpty(TargetUserName);
	}
}

public string CurrentUserName
{
	get
	{
		if (UserIsLoggedIn)
			return Context.User.Identity.Name;
		else
			return null;
	}
}

public string TargetUserName
{
	get
	{
		return Context.Items["UserName"] as string;
	}
}

MembershipUser currentUser = null;
public MembershipUser CurrentUser
{
	get
	{
		if (currentUser == null)
			currentUser = Membership.GetUser();

		return currentUser;
	}
}

MembershipUser targetUser = null;
public MembershipUser TargetUser
{
	get
	{
		if (targetUser == null &amp;&amp; !CurrentUserIsTargetUser)
			targetUser = Membership.GetUser(TargetUserName);

		return targetUser;
	}
}</pre>
<p>These properties provide the basics of handling users to all of my pages.  The first thing I want to point out is that I&#8217;m not using Membership everywhere; I&#8217;m only using it for getting the actual MembershipUser objects.  Elsewhere, I am using the Context to get the information that already resides there.   <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">Context.User</span> provides the user from a broader scope &#8211; any authentication &#8211; and is already there.  Membership, on the other hand, provides information only from the Membership provider and contains more information.  I am using this only where it is needed.  (Thanks to <a title="Pierreten@StackOverflow" href="http://stackoverflow.com/users/225313/pierreten" target="_blank">Pierreten</a> and <a title="Thomas@StackOVerflow" href="http://stackoverflow.com/users/198643/thomas" target="_blank">Thomas</a> at <a title="Stack Overflow" href="http://stackoverflow.com/" target="_blank">stackoverflow</a> for assisting me with figuring out the <a title="Membership.GetUser() vs. Context.User" href="http://stackoverflow.com/questions/2734180/membership-getuser-vs-context-user" target="_blank">difference between <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">Membership.GetUser()</span> and <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">Context.User</span></a>.)</p>
<p>Since we have two user contexts to keep in mind, that of the current user and that of the user we are viewing (the target user), we are providing access to information about both of these.  You will also notice a <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">CurrentUserIsTargetUser</span> property &#8211; this allows us to check if we are viewing a different user or if we are defaulting to the current user for all viewing purposes.  Looking back on it now, I&#8217;m not sold on the name of this property, because I want this to be false if we are viewing our own information through a user context switch &#8211; this will allow the user to see their own information from the eyes of a friend.</p>
<p>Improving on our &#8220;page being served&#8221; example from <a title="User context." href="http://hiddensanctum.wordpress.com/2010/03/29/user-context/" target="_blank">my user context post</a>, we can now do the following:</p>
<pre>&lt;% if (UserIsLoggedIn) { %&gt;
	You are &lt;%= CurrentUserName %&gt;.
&lt;% } else { %&gt;
	You are a nonny mouse.
&lt;% } %&gt;

&lt;% if (!CurrentUserIsTargetUser) { %&gt;
	&lt;br /&gt;
	You are looking for &lt;%= TargetUserName %&gt;.
&lt;% } %&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=50&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/08/28/membership/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
		<item>
		<title>MasterPages</title>
		<link>http://hiddensanctum.wordpress.com/2010/04/28/masterpages/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/04/28/masterpages/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 03:05:27 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[MasterPages]]></category>
		<category><![CDATA[Nested MasterPages]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=43</guid>
		<description><![CDATA[In order to implement a consistent design throughout the site, I am implementing MasterPages.  Specifically, since there will be many modules and areas within the application, and I will want each to have its own layout and style on top of the basics, I am implementing Nested MasterPages. I have a base MasterPage (Base.Master) in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=43&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In order to implement a consistent design throughout the site, I am implementing <a href="http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx" target="_blank">MasterPages</a>.  Specifically, since there will be many modules and areas within the application, and I will want each to have its own layout and style on top of the basics, I am implementing <a href="http://msdn.microsoft.com/en-us/library/x2b3ktt7.aspx" target="_blank">Nested MasterPages</a>.</p>
<p>I have a base MasterPage (Base.Master) in my root directory, and I will have at least one Nested MasterPage in each module (to include the root directory).  The base MasterPage will contain the bare basics &#8211; login functionality, a footer, and common links.  The base MasterPage provides three ContentPlaceHolders &#8211; one for the title, one for additional needs in the head of the page, and one for the main content:</p>
<pre>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Base.master.cs" Inherits="net.hiddensanctum.web.Base" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
    &lt;title&gt;
        &lt;asp:ContentPlaceHolder ID="cphTitle" runat="server" /&gt;
    &lt;/title&gt;
    &lt;asp:ContentPlaceHolder ID="cphHead" runat="server" /&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:ContentPlaceHolder ID="cphBody" runat="server" /&gt;
    &lt;/div&gt;

    &lt;div&gt;
        © 2010 hiddensanctum.net
    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>The Nested MasterPages will address site module-specific layouts as well as append a distinct string to the end of each Page title.  For example:</p>
<pre>&lt;%@ Master Language="C#" MasterPageFile="~/Base.Master" AutoEventWireup="true" CodeBehind="NestedLibrary.master.cs" Inherits="net.hiddensanctum.web.library.NestedLibrary" %&gt;

&lt;asp:Content ID="Content1" ContentPlaceHolderID="cphTitle" runat="server"&gt;
    &lt;asp:ContentPlaceHolder ID="cphTitle" runat="server" /&gt; - hiddensanctum.net library
&lt;/asp:Content&gt;

&lt;asp:Content ID="Content2" ContentPlaceHolderID="cphHead" runat="server"&gt;
    &lt;asp:ContentPlaceHolder ID="cphHead" runat="server" /&gt;
&lt;/asp:Content&gt;

&lt;asp:Content ID="Content3" ContentPlaceHolderID="cphBody" runat="server"&gt;
    &lt;asp:ContentPlaceHolder ID="cphBody" runat="server" /&gt;
&lt;/asp:Content&gt;</pre>
<p>All of the values appended to the title will have &#8221; &#8211; hiddensanctum.net&#8221; at the beginning.  It would be nice to be able to place this in the Base.Master, but the Base.Master title gets overridden when there is something from the Nested MasterPage going into the title.</p>
<p>MasterPages will focus solely on presentation &#8211; universal logic will be placed in a separate base class (PageBase) which I will cover as I go over Membership, Profiles, and Themes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=43&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/04/28/masterpages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
		<item>
		<title>Providers</title>
		<link>http://hiddensanctum.wordpress.com/2010/04/12/providers/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/04/12/providers/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 01:30:05 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[Membership Provider]]></category>
		<category><![CDATA[Profile Provider]]></category>
		<category><![CDATA[Providers]]></category>
		<category><![CDATA[Role Provider]]></category>
		<category><![CDATA[SQL Session State Provider]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=38</guid>
		<description><![CDATA[It&#8217;s too late to do anything useful for school, and I&#8217;m not going to be up late enough to be useful for work, so I finally have an opportunity to make a short post! I&#8217;ve decided to use one database to hold all of the providers I plan on using:  Membership, Profile, Role, Session State. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=38&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s too late to do anything useful for school, and I&#8217;m not going to be up late enough to be useful for work, so I finally have an opportunity to make a short post!</p>
<p>I&#8217;ve decided to use one database to hold all of the providers I plan on using:  Membership, Profile, Role, Session State.  I&#8217;ve made this decision because I don&#8217;t expect any of these to grow quickly &#8211; the fastest-growing table should be the one for Session State, and even that won&#8217;t be that fast (unless you sparse readers have a lot of friends) and can be cleared often with a job.  If they <em>do</em> end up growing too quickly, I will split them out.</p>
<p>I used <a href="http://msdn.microsoft.com/en-us/library/ms229862.aspx" target="_blank">aspnet_regsql</a> to create the provider database, but I had to run two commands, because you can&#8217;t create a session state database while also creating the support for the other providers.  (They probably don&#8217;t want you to have them all in the same place.)</p>
<p>The command I used to create the Providers database with the Membership, Profile, and Role providers:</p>
<pre>aspnet_regsql -S DEVLT01\SQLEXPRESS -E -A mrp -d Providers</pre>
<p>The command I used to add the SQL Session State provider support to the Providers database:</p>
<pre>aspnet_regsql -S DEVLT01\SQLEXPRESS -E -ssadd -sstype c -d Providers</pre>
<p>At some point, I will script this database out and save the script to my solution &#8211; this will let me deploy scripts to other environments (once I&#8217;m at that point).  I may try to use the <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">-sqlexportonly</span> argument to see what scripts that generates.  I&#8217;ll let you know how it goes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=38&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/04/12/providers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
		<item>
		<title>User context.</title>
		<link>http://hiddensanctum.wordpress.com/2010/03/29/user-context/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/03/29/user-context/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 02:17:15 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[Context]]></category>
		<category><![CDATA[Users]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=35</guid>
		<description><![CDATA[One of the first decisions I had to make was how to deal with user contexts.  Most of the pages in the application will be available to the public &#8211; at least, a view of them will be.  Eventually, once I implement friends (or connections of some sort), there will be more fine-grained levels of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=35&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the first decisions I had to make was how to deal with user contexts.  Most of the pages in the application will be available to the public &#8211; at least, a view of them will be.  Eventually, once I implement friends (or connections of some sort), there will be more fine-grained levels of control for access to certain objects &#8211; the security model will be a post for another time.</p>
<p>So, back to user contexts.  Because I want users to be able to link others directly to, say, a certain list of their library books, I need to be able to specify which user&#8217;s information a page should be displaying.  I could do it in the query string, but I think that&#8217;s a bit cheesy, so I wanted to avoid that.  I wanted to be able to pick up on users and applications through the path &#8211; so, for instance, http://hiddensanctum.net/megan.fox/library would serve up megan.fox&#8217;s library, while just http://hiddensanctum.net/library would serve up my own library (assuming I&#8217;m logged in).</p>
<p>The problem with the above example, though, is this:  if I go to http://hiddensanctum.net/megan.fox, I would reasonably expect to pull up megan.fox&#8217;s profile.  (This will seem less reasonably when I write a post about implementing it, but, for now, let&#8217;s assume that it&#8217;s a reasonable expectation.)  However, what if I go to http://hiddensanctum.net/library?  Would I expect to be brought to my library&#8230; or to the profile of a user named library?</p>
<p>In order to make this work, I need to identify users a bit more concretely.  The first idea that came to mind was to use the tilde that you see other places; for example, http://hiddensanctum.net/~megan.fox/library.  However, I don&#8217;t like how that looks, and it sort of gets away from the natural flow of a path, in my mind.  There&#8217;s an obvious break where the username is being emphasized.</p>
<p>The next idea was to use a period in place of the tilde; for example, http://hiddensanctum.net/.megan.fox/library.  However, that still breaks the flow &#8211; and, now that I&#8217;ve typed it out with a username that has a period in it, it looks even worse than the tilde option above.</p>
<p>Then I had it!  http://hiddensanctum.net/u/megan.fox/library.  That keeps with what I wanted, and I think it looks pretty good.  But how to implement it?</p>
<p>I ran the situation by a coworker of mine, Mike, and he pointed me to <a href="http://www.asp.net/mvc/whatisaspmvc/" target="_blank">MVC</a> as a possibility. However, having had some experience with <a href="http://msdn.microsoft.com/en-us/magazine/cc188690.aspx" target="_blank">MVP</a> at work, I wanted to avoid MVC if I could.  I think the application is going to get pretty complicated already; I&#8217;d like to keep it as simple as possible where I can.  Maintainability is key.</p>
<p>However, I <em>did</em> do some poking around into MVC, and I came across something called <a href="http://msdn.microsoft.com/en-us/library/cc668201.aspx" target="_blank">Routing</a>, which is how MVC actually creates and uses virtual paths.  I followed <a href="http://msdn.microsoft.com/en-us/default.aspx" target="_blank">MSDN</a>&#8216;s <a href="http://msdn.microsoft.com/en-us/library/cc668202.aspx" target="_blank">How to: Use Routing with Web Forms</a>, and, with some extra legwork, got what I think is a good solution.  I won&#8217;t go into the web.config changes made, as those are given step by step in the MSDN article, but the code I am using follows:</p>
<p>In my Global.asax, I am registering the user context route like so:</p>
<pre>protected void RegisterRoutes(RouteCollection routes)
{
    // Change viewing context from current user to user specified by {UserName}
    routes.Add(
        new Route(
            "u/{UserName}/{*Path}",
            new UserRouteHandler()
        )
    );
}</pre>
<p>This is called from the Application_Start method:</p>
<pre>protected void Application_Start(object sender, EventArgs e)
{
    RegisterRoutes(RouteTable.Routes);
}</pre>
<p>The registered route will handle only URLs of the form http://hiddensanctum.net/u/{username} and any sub-URLs.  So if you go to http://hiddensanctum.net/library, you will hit the library folder directly; however, if you go to http://hiddensanctum.net/u/megan.fox/library, the new RouteHandler will handle the request.</p>
<p>How is the request handled?  Let&#8217;s take a look:</p>
<pre>public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
    // Get path variables from Routing
    string userName = requestContext.RouteData.Values["UserName"] as string;
    string path = requestContext.RouteData.Values["Path"] as string;

    // Assign "UserName" from Routing to the HttpContext
    requestContext.HttpContext.Items["UserName"] = userName.ToLower();

    // Fix path to ensure that a blank path end points to a Default.aspx page
    path = EnsurePathPointsToAspx(path);

    // Return a new instance of the requested path
    return BuildManager.CreateInstanceFromVirtualPath(
        path,
        typeof(Page)
    ) as IHttpHandler;
}</pre>
<p>First, we get the username provided and the path the visitor is trying to reach.  We will assign the username into the context in order to pass it into the page we are creating.  Then we do some cleanup (see end of post) and create a new IHttpHandler of the actual page requested to return.  This will allow the page being requested to be served &#8211; and now it will have access to the username we added to the context.  Simple as that!  Now, in the page that is being served, we can do something like this:</p>
<pre>&lt;% if (string.IsNullOrEmpty(Context.Items["UserName"] as string)) { %&gt;
    You are looking for your own information.
&lt;% } else { %&gt;
    You are looking for: &lt;%= Context.Items["UserName"]%&gt;.
&lt;% } %&gt;</pre>
<p>Of course, once we have some content, this will be more sophisticated and driven through the code-behind, but this illustrates the point.</p>
<p>Now, some of you are wondering, &#8220;When is this incredibly long post going to end?&#8221;  And some few of you die-hard sparse readers are wondering, &#8220;Wait a second!  What&#8217;s that &#8216;cleanup&#8217; bit you did there with the hand waving and the not telling us?&#8221;  Well, in answer to the first question &#8211; after I answer the second:</p>
<p>One of the things we unfortunately lose when we&#8217;re doing Routing this way is IIS&#8217;s assignment of a default page when a visitor requests a directory (such as http://hiddensanctum.net/library).  So my cleanup code just ensures that the path requested ends in an ASPX file:</p>
<pre>///
/// Ensures that the given path ends with .aspx.
///
protected string EnsurePathPointsToAspx(string path)
{
    string result = path;

    // Ex.: The incoming url is /u/name/
    if (string.IsNullOrEmpty(result))
        result = DEFAULT_FILENAME;

    // Ex.: The incoming url is /u/name/library/
    else if (result.EndsWith("/"))
        result = string.Format("{0}{1}", result, DEFAULT_FILENAME);

    // Ex.: The incoming url is /u/name/library
    else if (!result.ToLower().EndsWith(".aspx"))
        result = string.Format("{0}/{1}", result, DEFAULT_FILENAME);

    return string.Format("~/{0}", result);
}</pre>
<p>This could be more complicated, but it&#8217;s been left simple for now because I currently plan to put anything not an ASPX file under the App_Themes folder.  Whether or not this decision will pan out as development continues is yet to be seen, but I will post any updates I make if it doesn&#8217;t.</p>
<p>One thing you will notice about the above code is that there is no handling of query strings.  I originally had code to handle pages with query strings, but then I noted an odd behavior &#8211; even when there <em>were</em> query strings, they never showed up in the path that I got from my Routing.  Turns out, this is because the query strings are automatically stripped out and put into the Request; no handling is necessary.  (Of course, if you need it for your routing, you can access it through <span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">requestContext.HttpContext.Request<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;white-space:normal;font-size:13px;">.)</span></span></p>
<p>Tune in next time for Themes and Profiles!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=35&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/03/29/user-context/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
		<item>
		<title>What&#8217;s going on in this thread?</title>
		<link>http://hiddensanctum.wordpress.com/2010/03/28/whats-going-on-in-this-thread/</link>
		<comments>http://hiddensanctum.wordpress.com/2010/03/28/whats-going-on-in-this-thread/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 00:01:58 +0000</pubDate>
		<dc:creator>hiddensanctum</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hiddensanctum.wordpress.com/?p=4</guid>
		<description><![CDATA[Welcome, sparse readers!  This blog has been started to chronicle my adventures as I develop a new web application named hiddensanctum.net. While I&#8217;ve been sitting on the domain for a while, what sparked this effort was a promise to my girlfriend, a rabid bibliophile, that I would make her a tool through which she could [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=4&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome, sparse readers!  This blog has been started to chronicle my adventures as I develop a new web application named hiddensanctum.net.</p>
<p>While I&#8217;ve been sitting on the domain for a while, what sparked this effort was a promise to my girlfriend, a rabid bibliophile, that I would make her a tool through which she could track her books and interact with her book lists.  Toward that end, I have decided to create a base on top of which I can develop a number of modules (that number currently being one &#8211; the library module).  The base site will provide basic functionality such as membership, theming, and profiles.  The modules will provide their own functionality.</p>
<p>I decided to blog about the process for a number of reasons.  One, I plan to post code snippets that will likely help me out in the future &#8211; and will hopefully help others as well.  Two, I think it will be interesting to look back on the process and see what I&#8217;ve done and where it all went so horribly, horribly wrong.</p>
<p>As a note of warning, between working full time and working on my doctorate, this project is not my top priority, so the project and the blogging will probably be slow going.</p>
<p>I&#8217;d already made some headway on the application before deciding to start this, so I will be making a couple catch-up posts before continuing on with development.</p>
<p><strong>Edit 3/28/10 8:07 PM:</strong> Oh yeah &#8211; this is all being done in ASP.NET with a C# code-behind and a SQL Server 2008 back-end.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hiddensanctum.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hiddensanctum.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hiddensanctum.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hiddensanctum.wordpress.com&amp;blog=12772744&amp;post=4&amp;subd=hiddensanctum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hiddensanctum.wordpress.com/2010/03/28/whats-going-on-in-this-thread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ba15570b00f4c2e0e44bce297618c828?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hiddensanctum</media:title>
		</media:content>
	</item>
	</channel>
</rss>
