<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5051650069922908295</id><updated>2024-09-19T12:18:07.921-07:00</updated><category term="ASP.NET"/><category term="Tutorial"/><category term="ADO.NET"/><category term="SqlServer"/><category term="Access Denied"/><category term="Application Pool"/><category term="C#"/><category term="EventLog"/><category term="How To"/><category term="IIS"/><category term="JavaScript"/><title type='text'>ASP.NET Site</title><subtitle type='html'>Short and effective beginner tutorials and problem solvers using ASP.NET 2.0+, Javascript, ADO.NET, MSSQL Server</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5051650069922908295.post-6828797203184208355</id><published>2011-09-25T08:15:00.000-07:00</published><updated>2011-09-25T08:22:40.590-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Denied"/><category scheme="http://www.blogger.com/atom/ns#" term="Application Pool"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="EventLog"/><category scheme="http://www.blogger.com/atom/ns#" term="IIS"/><title type='text'>&quot;Access Denied&quot; error when writing into Event Log</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;When &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #b6d7a8;&quot;&gt;EventLog.WriteEntry(...)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;is used&amp;nbsp;to write a log record in specific event log a pretty common error is the &quot;Access Denied&quot; message. That means you need to grant access to the user account that&#39;s been used by your Application pool. The account your web application uses to run is in &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #b6d7a8;&quot;&gt;&quot;Internet Information Services (IIS) Manager -&amp;gt; Application Pools -&amp;gt; Your web Application Pool -&amp;gt; Advanced Settings -&amp;gt; Identity&quot;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;You need to give this user Read/Write permissions in the Log that you are trying to write into.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #b6d7a8;&quot;&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\YourLogName&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; white-space: normal;&quot;&gt;It&#39;s accessible by the Register Editor.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif; white-space: normal;&quot;&gt;The usual accounts that ASP.NET uses are NETWORK SERVICE (in WinSrv2003/2008 and Win7,Vista) and ASPNET in WinXP.&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/6828797203184208355/comments/default' title='Коментари за публикацията'/><link rel='replies' type='text/html' href='http://aspnetsite.blogspot.com/2011/09/access-denied-error-when-writing-into.html#comment-form' title='0 коментара'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/6828797203184208355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/6828797203184208355'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/2011/09/access-denied-error-when-writing-into.html' title='&quot;Access Denied&quot; error when writing into Event Log'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5051650069922908295.post-2718628322746451656</id><published>2011-01-21T01:02:00.000-08:00</published><updated>2011-01-21T01:08:46.577-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ADO.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Bind DataTable To GridView using TemplateFields ASP.NET</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;You have&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt; a DataTable object with data filled from your database. There is a &lt;a href=&quot;http://aspnetsite.blogspot.com/2011/01/get-data-from-ms-sql-database-with.html&quot; style=&quot;color: #a2c4c9;&quot; target=&quot;_blank&quot;&gt;&quot;how to&quot; here&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;In the *.aspx page:&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;asp:GridView id=&quot;gViewSample&quot;&amp;nbsp; runat=&quot;server&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;Columns&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;asp:TemplateField&amp;nbsp; ItemStyle-&lt;i&gt;CssClass&lt;/i&gt;=&quot;GridItemClass&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;ItemTemplate&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;asp:Button ID=&quot;btnItem&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;Item_id&quot;) %&amp;gt;&#39; /&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/ItemTemplate&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;asp:TemplateField&amp;nbsp; ItemStyle-&lt;i&gt;CssClass&lt;/i&gt;=&quot;GridItemClassDescription&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;ItemTemplate&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;asp:Label ID=&quot;lblItemDescription&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# GetItemDescription(Container.DataItem) %&amp;gt;&#39; /&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/ItemTemplate&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/Columns&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;/asp:GridView&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;In the Code behind (C#)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;protected string GetItemDescription(object dataItem)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strint itemDescription = DataBinder.Eval(dataItem, &quot;Description&quot;).ToString();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // here is where you do some manipulation with the field data.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return itemDescription;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;In your *.css file you put styles for the header/item/footer templates&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;.Griditemclass&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;width: 70px;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;color: Black;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;/* etc. etc. */&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;The binding itself:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;protected void Page_Load(object sender, EventArgs e)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gViewSample.DataSource = dt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gViewSample.DataBind();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #444444; color: #d9ead3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;-------------------------------------------- &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;The Template fields: you can get data there either directly from the DataTable using Eval(&quot;FieldName&quot;) either by function in the code behind (like GetItemDescription) if you need to manipulate your data. You put your css classes in an external file.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/2718628322746451656/comments/default' title='Коментари за публикацията'/><link rel='replies' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/bind-datatable-to-custom-gridview-using.html#comment-form' title='0 коментара'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/2718628322746451656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/2718628322746451656'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/bind-datatable-to-custom-gridview-using.html' title='Bind DataTable To GridView using TemplateFields ASP.NET'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5051650069922908295.post-3445763051264393380</id><published>2011-01-20T14:06:00.000-08:00</published><updated>2011-01-20T23:48:02.648-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="SqlServer"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>How to Store ASP.NET Sessions in MSSql Database</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Change the settings inside the session tag in your application web.config file:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #444444; color: #d9ead3;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;background-color: #444444;&quot;&gt;&amp;lt;sessionState allowCustomSqlDatabase=&quot;true&quot; cookieless=&quot;UseCookies&quot;&lt;/span&gt; &lt;span style=&quot;background-color: #444444;&quot;&gt;cookieName=&quot;HTTP_COOKIE&quot; mode=&quot;SQLServer&quot;&lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;background-color: #444444;&quot; /&gt; &lt;span style=&quot;background-color: #444444;&quot;&gt;&lt;span style=&quot;background-color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; regenerateExpiredSessionId=&quot;true&quot; sqlConnectionString=&quot;data source=ServerName\SqlInstance;&lt;/span&gt; &lt;/span&gt;&lt;br style=&quot;background-color: #444444;&quot; /&gt; &lt;span style=&quot;background-color: #444444;&quot;&gt;&lt;span style=&quot;background-color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataBase=dbName;Integrated Security=True&quot; stateConnectionString=&quot;tcpip=127.0.0.1:42424&quot;&lt;/span&gt; &lt;/span&gt;&lt;br style=&quot;background-color: #444444;&quot; /&gt; &lt;span style=&quot;background-color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stateNetworkTimeout=&quot;20&quot; timeout=&quot;500&quot; /&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;configuration&gt;&lt;sessionstate cookieless=&quot;false&quot; instance=&quot;&quot; mode=&quot;sqlserver&quot; sqlconnectionstring=&quot;data source=&amp;lt;span title=&quot; style=&quot;color: #d9ead3; font-weight: bold;&quot; timeout=&quot;20&quot; your=&quot;&quot;&gt;&lt;/sessionstate&gt;
Open the Command Prompt, &lt;/configuration&gt;&lt;span style=&quot;font-size: small;&quot;&gt;go to&lt;/span&gt; &quot;C:\Windows\Microsoft.NET\Framework\v2.0.50727&quot;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;and run this command:&amp;nbsp; &lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #444444; color: #d9ead3; font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif; font-size: x-small;&quot;&gt;aspnet_regsql.exe -S &amp;lt;Server\Instance&amp;gt; -U &amp;lt;Username&amp;gt; -P &amp;lt;Password&amp;gt; -ed -d &amp;lt;DataName&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;After this command, two tables (&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;ASpStateTempApplications&lt;/span&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt; and &lt;/span&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;ASPStateTempSessions&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;are created in the selected database as well as several stored procedures and sql job for&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;deleting/updating/inserting sessions in the tables. The SQL account you used in this&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;command must also have rights to make changes on the database, otherwise you get an&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&quot;no execute permission&quot; error. You can check the settings you just set in the web.config&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;file in the IIS &quot;Session State&quot; section - they should be the same. In this scenario you&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;have 500 minutes timeout of your session cookies. You have &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;regenerateExpiredSessionId&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;set to &quot;True&quot; which means that any postback made by the user updates the record in the&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;database and changes the expiration time of your session record.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/3445763051264393380/comments/default' title='Коментари за публикацията'/><link rel='replies' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/how-to-store-aspnet-sessions-in-ms-sql.html#comment-form' title='0 коментара'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/3445763051264393380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/3445763051264393380'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/how-to-store-aspnet-sessions-in-ms-sql.html' title='How to Store ASP.NET Sessions in MSSql Database'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5051650069922908295.post-1253942938558900894</id><published>2011-01-20T13:45:00.000-08:00</published><updated>2011-01-20T13:50:46.534-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ADO.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="SqlServer"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Get Data From MS SQL Database with ADO.NET C#</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In the code-behind you have:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;-------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;using System.Data.SqlClient;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;using System.Data;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;string yourSqlQuery = &quot;SELECT ID, Decsription FROM Articles Where ManufacturerName = @ParamName&quot;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;string connString = &quot;Data Source=ServerName\\SqlInstance;Database=dbName;User=UserAcc;password=Pwd;Integrated Security=False&quot;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SqlConnection conn = new SqlConnection(connString);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SqlCommand cmd = new SqlCommand(yourSqlQuery, conn);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;cmd.Parameters.AddWithValue(&quot;@ParamName&quot;, &quot;paramValue&quot;);&lt;br /&gt;
if (conn.State != ConnectionState.Open)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.Open();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SqlDataAdapter adapter = new SqlDataAdapter(cmd);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;DataTable dt = new DataTable();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #b6d7a8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;adapter.Fill(dt);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;------------------------------ &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Note: Account &quot;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;UserAcc&quot; used to run the query needs permissions in the SqlServer -&amp;gt; Security -&amp;gt; Logins. In case you use Integrated Security=True you actually use Network Services account (or ASPNET in Win XP) and should consider granting necessary permissions. Have in mind that firewalls, routers can also block your connection to the SqlServer.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/1253942938558900894/comments/default' title='Коментари за публикацията'/><link rel='replies' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/get-data-from-ms-sql-database-with.html#comment-form' title='0 коментара'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/1253942938558900894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/1253942938558900894'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/get-data-from-ms-sql-database-with.html' title='Get Data From MS SQL Database with ADO.NET C#'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5051650069922908295.post-7020603274067101528</id><published>2011-01-20T03:02:00.000-08:00</published><updated>2011-01-20T14:53:11.699-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="How To"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial"/><title type='text'>Capture Enter Key in Textbox with JavaScript</title><content type='html'>&lt;div style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;In the code behind (*.cs file) you have to attach the event handler:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;protected void Page_Load(object sender, EventArgs e)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d9ead3; font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;/b&gt;textField.Attributes.Add(&quot;onkeypress&quot;, &quot;return textBoxOnKeyDown(this);&quot;);&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d9ead3; font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;textField.Attributes.Add(&quot;onkeydown&quot;, &quot;return textBoxOnKeyDown(this);&quot;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #d9ead3;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;The JavaScript (in the *.js file) for the event handler:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #d9ead3;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
function textBoxOnKeyDown(elementRef)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;var keyCodeEntered = (event.which) ? event.which : (window.event.keyCode) ? window.event.keyCode : -1;&lt;/span&gt; &lt;/div&gt;&lt;div style=&quot;color: #d9ead3;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;if ( keyCodeEntered == 13 )&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;%= ClientScript.GetPostBackEventReference(testAnchor, string.Empty) %&amp;gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d9ead3;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;return false;&lt;br /&gt;
&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #d9ead3;&quot;&gt;&amp;nbsp;return true;&lt;/span&gt;&lt;br style=&quot;color: #d9ead3;&quot; /&gt;&lt;span style=&quot;color: #d9ead3;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;color: #d9ead3;&quot; /&gt;&lt;span style=&quot;color: #d9ead3;&quot;&gt;// --&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function textBoxOnKeyDown(elementRef)
{
var keyCodeEntered = (event.which) ? event.which : (window.event.keyCode) ? window.event.keyCode : -1;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: courier new;&quot;&gt;

&lt;span style=&quot;font-size:85%;&quot;&gt; if ( keyCodeEntered == 13 )
{
&lt;%= ClientScript.GetPostBackEventReference(testAnchor, string.Empty) %&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: courier new;&quot;&gt;

&lt;span style=&quot;font-size:85%;&quot;&gt;  return false;
}&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: courier new;&quot;&gt;

&lt;span style=&quot;font-size:85%;&quot;&gt; return true;
}
// --&gt;
&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Note: &quot;onkeypress&quot; event works with IE 6+, Chrome, Opera while onkeydown works with Mozilla. You can &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;add any key value (Enter key is &#39;13&#39;) and try to make a more complex javascript function depending on your needs.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspnetsite.blogspot.com/feeds/7020603274067101528/comments/default' title='Коментари за публикацията'/><link rel='replies' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/catch-enter-key-in-textbox-with.html#comment-form' title='3 коментара'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/7020603274067101528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5051650069922908295/posts/default/7020603274067101528'/><link rel='alternate' type='text/html' href='http://aspnetsite.blogspot.com/2011/01/catch-enter-key-in-textbox-with.html' title='Capture Enter Key in Textbox with JavaScript'/><author><name>joppo</name><uri>http://www.blogger.com/profile/07084449787271866513</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>