<?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>Getting Started</title><link>http://forums.asp.net/15.aspx</link><description>The perfect forum for ASP.NET novices. No question too simple! &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=21&amp;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: Storing user and database connection information in Session variables</title><link>http://forums.asp.net/thread/2064532.aspx</link><pubDate>Mon, 17 Dec 2007 22:12:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2064532</guid><dc:creator>mark836</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2064532.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2064532</wfw:commentRss><description>&lt;p&gt;Good tip about a class and session variables.&amp;nbsp; I just implemented your suggestion,&amp;nbsp;Thanks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I haven&amp;#39;t recieved any input from question 1 so I am assuming it is normal procedure.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Storing user and database connection information in Session variables</title><link>http://forums.asp.net/thread/2064212.aspx</link><pubDate>Mon, 17 Dec 2007 19:16:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2064212</guid><dc:creator>martinhn</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2064212.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2064212</wfw:commentRss><description>&lt;p&gt;Regarding question 2 - I would always recommend having a static class with all the session variables. DO NOT (!!!) write Session[&amp;quot;variableName&amp;quot;] everytime you need to access a session variable. It is so easy to make typo&amp;#39;s, and you do not get compilation errors if you misspell a variable name.&lt;/p&gt;
&lt;p&gt;Create a static class with a property for each session variable you have to use, which returns the value. Then you get/set the Session like this: Session[SessionKeys.Parameter1] which is much more safe, and easier to maintain should you need to refactor the code later...&lt;/p&gt;</description></item><item><title>Storing user and database connection information in Session variables</title><link>http://forums.asp.net/thread/2063932.aspx</link><pubDate>Mon, 17 Dec 2007 16:50:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2063932</guid><dc:creator>mark836</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2063932.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2063932</wfw:commentRss><description>&lt;p&gt;2 quick/easy questions which are very subjective.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Our client has client/server database &amp;nbsp;apps and wants to replace them with Intranet apps.&amp;nbsp; Their security is primarily database roles.&amp;nbsp; In order to keep their current security ( a requirement), I have created login page where the user selects from a list of servers, and inputs for their database userid/password.&amp;nbsp;I encrypt the password using the standard&amp;nbsp;class &lt;font color="#008080" size="2"&gt;DESCryptoServiceProvider&lt;/font&gt;.&amp;nbsp; I am going to&amp;nbsp;store this user connection info(user id,&amp;nbsp; encrypted password and password encrypt key, and database server) &amp;nbsp;into an arrayList Session variable.&amp;nbsp;&amp;nbsp;Everytime I need to connect to the database, I get&amp;nbsp;the database connection stored&amp;nbsp;string(&lt;font color="#008080" size="2"&gt;ConfigurationManager&lt;/font&gt;&lt;font size="2"&gt;.ConnectionStrings), and replace the userid,password, and server with the arraylist user values.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;In the the future, I am going to try to convince the client to store user profile info into a database table.&amp;nbsp; Connect to the database with one user/password from &lt;font color="#008080"&gt;ConfigurationManager&lt;/font&gt;&lt;font size="2"&gt;.ConnectionStrings.&amp;nbsp; But for now, I need to work with the current security in place&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;1.&amp;nbsp; Is there, if any, dangers and pitfalls to my proposed solution.&amp;nbsp; Or to put it in another way, is there a better way to handle this user info?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;2.&amp;nbsp; Session state is by Page and I cannot create a custom class to get/set session variables.&amp;nbsp; Is there an elegant way to set the session variables&amp;nbsp;in a class?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;font size="2"&gt;Thanks in advance for your input.&amp;nbsp; &lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&amp;nbsp;replace &lt;/p&gt;</description></item></channel></rss>