<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Security</title><link>http://forums.asp.net/25.aspx</link><description>All about ASP.NET security (authentication, authorization, membership, roles, etc.) and the Login controls. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=24&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Using Single Sign On in Multiple Applications Sharing Same Domain</title><link>http://forums.asp.net/thread/2614630.aspx</link><pubDate>Thu, 11 Sep 2008 08:17:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2614630</guid><dc:creator>vmanzu_1977</dc:creator><author>vmanzu_1977</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2614630.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=2614630</wfw:commentRss><description>&lt;p&gt;Thanks for the nice article . I have these questions &lt;/p&gt;
&lt;p&gt;1) Will this work if the two sites are on different boxes?&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;Will it work behind a&amp;nbsp;NLB ?&lt;/p&gt;
&lt;p&gt;Thanks ,&lt;/p&gt;
&lt;p&gt;Manjunatha&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Using Single Sign On in Multiple Applications Sharing Same Domain</title><link>http://forums.asp.net/thread/1653051.aspx</link><pubDate>Thu, 05 Apr 2007 11:10:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1653051</guid><dc:creator>chirag_darji</dc:creator><author>chirag_darji</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1653051.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1653051</wfw:commentRss><description>&lt;p&gt;HI,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Thanks for your artcle. There some some more information abt single sign on &lt;a class="" title="Chirag Darji" href="http://chiragrdarji.wordpress.com/" target=_blank&gt;http://chiragrdarji.wordpress.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Hope you like it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Using Single Sign On in Multiple Applications Sharing Same Domain</title><link>http://forums.asp.net/thread/1390821.aspx</link><pubDate>Wed, 06 Sep 2006 10:08:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1390821</guid><dc:creator>usmaniac4life</dc:creator><author>usmaniac4life</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1390821.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=25&amp;PostID=1390821</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;Using Forms Authentication&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Forms Authentication should be used for Single sign on into Multiple Applications. &lt;br /&gt;&lt;br /&gt;&amp;lt;authentication mode=&amp;quot;Forms&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;forms name=&amp;quot;.Website&amp;quot; loginUrl=&amp;quot;login.aspx&amp;quot; protection=&amp;quot;All&amp;quot; timeout=&amp;quot;30&amp;quot; path=&amp;quot;/&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/authentication&amp;gt;&lt;br /&gt;&lt;br /&gt;where &amp;quot;.Website&amp;quot; is the name of the Cookie used to store user credentials for form authentication&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Modifying the Machine Key&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The machineKey element might be configured in the machine.config file or on every web.config application file sharing the Same Cookie. By Default the encryption key to encrypt cookie data is set to something like this in the machine.config file:&lt;br /&gt;&lt;br /&gt;&amp;lt;machineKey&lt;br /&gt;validationKey=&amp;quot;AutoGenerate,IsolateApps&amp;quot; &lt;br /&gt;decryptionKey= &amp;quot;AutoGenerate,IsolateApps&amp;quot; &lt;br /&gt;validation=&amp;quot;SHA1&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;The &amp;quot;IsolateApps&amp;quot; means that a different key will be AutoGenerated for each application. This setting can be overridden by writing the following code in the Application&amp;#39;s Web.config file: &lt;br /&gt;&lt;br /&gt;&amp;lt;machineKey&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; validationKey= &amp;quot;C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; decryptionKey= &amp;quot;8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; validation=&amp;quot;SHA1&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;The Machine key should be the same for all the applications sharing the same cookie (Using SSO).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating Domain Level Cookie to share same information between Applications&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here, we are using two domains: &lt;br /&gt;&lt;a href="http://secure.website.net/"&gt;http://secure.website.net&lt;/a&gt; and&lt;br /&gt;&lt;a href="http://www.website.net/"&gt;http://www.website.net&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The cookies will be stored in different files and will not be accessible to both applications. In order to make it work, we will need to create domain-level cookies that are visible to all sub-domains:&lt;br /&gt;&lt;br /&gt;Dim fat As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, DateTime.Now.AddYears(1), False, &amp;quot;&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim cookie As HttpCookie = New HttpCookie(&amp;quot;.Web20Tools&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cookie.Value = FormsAuthentication.Encrypt(fat)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cookie.Expires = fat.Expiration&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cookie.Domain = &amp;quot;.website.net&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Cookies.Add(cookie)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here, &amp;quot;cookie.Domain&amp;quot; specifies the name of the domain by which the cookie would be created. Hence if the Windows user has logged in with the account name as &amp;quot;Admin&amp;quot;, the cookie would be created by the name:&lt;br /&gt;&lt;a href="mailto:Admin@website.net"&gt;Admin@website.net&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Data Of Expiry is exactly one year after the date of creation. The ticket name would be the same as the user name. So this can be decrypted on the other applications page Load when the request is redirected to another application.&lt;br /&gt;&lt;br /&gt;The cookie is encrypted and then added to the response stream. This cookie can now be shared by any application sharing the same subdomain name&lt;br /&gt;&lt;br /&gt;Note: For Domain wide authentication scenarios, you can set domain-wide cookie only for second level domain, or for third level domain if second level domain contains three or less characters. It means that you cannot set cookie for domain &amp;quot;com&amp;quot; or &amp;quot;co.in&amp;quot;, but can for &amp;quot;example.com&amp;quot; or &amp;quot;example.co.in&amp;quot;. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Simulation of the Live Site&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now to simulate the setup of the live sites, we need to add entries into the Hosts file, which is present at:&lt;br /&gt;C:/WINDOWS/SYSTEM32/DRIVERS/ETC&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(Windows XP)&lt;br /&gt;C:/WINNT/SYSTEM32/DRIVERS/ETC&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(Windows 2000, NT)&lt;br /&gt;&lt;br /&gt;The entries would be as follows:&lt;br /&gt;&lt;br /&gt;127.0.0.1 &lt;a href="http://www.website.net/"&gt;www.website.net&lt;/a&gt;&lt;br /&gt;127.0.0.1 secure.website.net&lt;br /&gt;&lt;br /&gt;This would help emulate the site on local server so that the cookies can be shared. The applications can be accessed after creating their virtual directories:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.website.net/website/default.aspx"&gt;http://www.website.net/website/default.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://secure.website.net/shoppingcart/default.aspx"&gt;http://secure.website.net/shoppingcart/default.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now to check whether the cookie has been created or not, the cookie created can be found at:&lt;br /&gt;C:\Documents and Settings\Default User\Local Settings\Temporary Internet Files\&lt;br /&gt;&lt;br /&gt;where &amp;quot;Default user&amp;quot; will be the name of the user who has logged in.&lt;br /&gt;&lt;br /&gt;An alternative method to check the cookie creation is to go to the Internet Explorer&amp;#39;s Tools Menu -&amp;gt; Internet Options -&amp;gt; Click on Privacy Tab -&amp;gt; Click Advanced Button .&lt;br /&gt;select &amp;quot;Override Automatic Cookie Handling&amp;quot; and then select the radio buttons for &amp;quot;First Party Cookies&amp;quot; and &amp;quot;Third Party Cookies&amp;quot; as &amp;quot;Prompt&amp;quot;.&lt;br /&gt;&lt;br /&gt;Doing this will enable prompting before cookie creation where the cookie name and the date of expiry can be tracked.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Logging Out of the Application&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;While Logging out of the application, the Expiration date of the Cookie should be set to a past date for the cookie to get deleted. The cookie should be fetched first using the httpcontext class and then the expiry date should be changed.&lt;br /&gt;&lt;br /&gt;Dim httpWebcookie As HttpCookie&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpWebcookie = Request.Cookies(&amp;quot;.Website&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpWebcookie.Domain = &amp;quot;.website.net&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; httpWebcookie.Expires = DateTime.Now.AddYears(-3)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Cookies.Add(httpWebcookie)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hope that this Article proves to be Useful for you guys.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Regards,&lt;/p&gt;&lt;p&gt;Usman Suglatwala.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>