ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Where to declare Session variable in ASP.Net? Global.ASAX?<p>&nbsp;</p> <pre class="brush: html">Hi Sir, I heard that Global.asax file is optional in asp.net web application. But, if we need to declare any session variables in my website, do i really need to add Global.asax file and initialize session variables inside Session_Start() ? Please suggest. Kiran</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/523283/Where-to-declare-Session-variable-in-ASPNet-GlobalASAX/http://www.aspforums.net/Threads/523283/Where-to-declare-Session-variable-in-ASPNet-GlobalASAX/Mon, 02 Nov 2015 07:12:07 GMTWhat is ViewState its Features Usage and Description in ASP.Net<p><strong>Hi</strong></p> <p><strong>I used these code in my page</strong></p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <pre class="brush: csharp"> string data = Server.UrlDecode(Request.QueryString[&#34;BehCode&#34;]); _cn.Open(); _cmd.Parameters.AddWithValue(&#34;@image&#34;, filename); _cmd.Parameters.AddWithValue(&#34;@Behcode&#34;, data); _cmd.Parameters.AddWithValue(&#34;@id&#34;, Convert.ToInt32(ViewState[&#34;Id&#34;])); int ID = Convert.ToInt32(_cmd.ExecuteScalar()); if (ID &gt; 0) { ViewState[&#34;Id&#34;] = ID.ToString(); } _cn.Close(); </pre> <p><strong>I don't any thing about ViewState&nbsp; what dose this code do?</strong></p> <p><strong>can you explain about it </strong></p> <p><strong>Best Regards</strong></p> <p>&nbsp;</p>http://www.aspforums.net/Threads/212994/What-is-ViewState-its-Features-Usage-and-Description-in-ASPNet/http://www.aspforums.net/Threads/212994/What-is-ViewState-its-Features-Usage-and-Description-in-ASPNet/Wed, 05 Dec 2012 01:22:24 GMTWhat is this error<p>An unhandled exception of type 'System.StackOverflowException' occurred in DataAccessLayer.DLL</p>http://www.aspforums.net/Threads/114310/What-is-this-error/http://www.aspforums.net/Threads/114310/What-is-this-error/Wed, 11 Jan 2012 00:13:11 GMTWhat is the Default Session TimeOut in ASP.Net and from where I can change it<p>hi,</p> <p>&nbsp;&nbsp; what is default session time out in asp.net, please let me know were i can able to put the code in the application.</p> <p>&nbsp;</p> <p>thanks in advance.</p>http://www.aspforums.net/Threads/136119/What-is-the-Default-Session-TimeOut-in-ASPNet-and-from-where-I-can-change-it/http://www.aspforums.net/Threads/136119/What-is-the-Default-Session-TimeOut-in-ASPNet-and-from-where-I-can-change-it/Wed, 12 Dec 2012 05:03:22 GMTWhat is Service Contract and Operational Contract Attributes in WCF Service<p>Hi</p> <p>Can any one give me an idea about service contract and operational contract in details</p> <p>Whether Service contract can be applied to class or only to the interface.</p> <p>What are the advantage of the service contract and operational contract in addition.</p> <p>thanks</p>http://www.aspforums.net/Threads/207527/What-is-Service-Contract-and-Operational-Contract-Attributes-in-WCF-Service/http://www.aspforums.net/Threads/207527/What-is-Service-Contract-and-Operational-Contract-Attributes-in-WCF-Service/Tue, 07 May 2013 04:39:08 GMTWhat is of this.Page.Controls.Add method in ASP.Net<pre class="brush: sql">sir what is the use of </pre> <pre class="brush: sql"> this.Page.Controls.Add(SqlDataSource1);</pre> <pre class="brush: sql">in the following code.</pre> <pre class="brush: sql">&nbsp;</pre> <pre class="brush: sql"> protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { SqlDataSource SqlDataSource1 = new SqlDataSource(); this.Page.Controls.Add(SqlDataSource1); SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings[&#34;ConnectionString&#34;].ConnectionString; SqlDataSource1.SelectCommand = &#34;SELECT * FROM users WHERE ElectionId =&#39;&#34; + this.TextBox1.Text.Trim() + &#34;&#39;&#34;; this.GridView1.DataSource = SqlDataSource1; this.GridView1.DataBind(); this.GridView1.Visible = true; }</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/869677/What-is-of-thisPageControlsAdd-method-in-ASPNet/http://www.aspforums.net/Threads/869677/What-is-of-thisPageControlsAdd-method-in-ASPNet/Wed, 08 May 2013 01:48:22 GMTWhat is DataBinder.Eval in ASP.Net<p>i have a doubt in this line..</p> <p>can u tell me what this line will do the operation</p> <pre class="brush: vb">&lt;%#&#34;default.aspx?UserId=&#34;+DataBinder.Eval(Container.DataItem,&#34;UserId&#34;) %&gt;&#39;&gt; &lt;%#Eval(&#34;UserName&#34;) %&gt;</pre> <p><br /><br /></p>http://www.aspforums.net/Threads/341945/What-is-DataBinderEval-in-ASPNet/http://www.aspforums.net/Threads/341945/What-is-DataBinderEval-in-ASPNet/Wed, 31 Oct 2012 03:22:13 GMTUnderstand the usage of AJAX jQuery SilverLight and MVC<p>sir i not able to understand the usage of ajax, j query ,silverlight and mvc.</p> <p>i studied lot but not having clear idea. i am begineer.</p> <p>pls give simple definitions for each.</p> <p>for what purpose we using each one.</p> <p>and also mvc is wat?</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/554896/Understand-the-usage-of-AJAX-jQuery-SilverLight-and-MVC/http://www.aspforums.net/Threads/554896/Understand-the-usage-of-AJAX-jQuery-SilverLight-and-MVC/Thu, 24 Jan 2013 03:59:12 GMTThe ConnectionString property has not been initialized error<p>Hi folks,</p> <p>I am getting above mentioned error when I try to run the following code: </p> <pre class="brush: vb"> Private strConnString As String = ConfigurationManager.ConnectionStrings(&#34;conString&#34;).ConnectionString Private con As New SqlConnection(strConnString) Private pID As Integer <br />&#39;FIRST SECTION Dim query As String = &#34;query&#34; Dim cmd As New SqlCommand(query) cmd.Parameters.Add(&#34;@pID&#34;, SqlDbType.Int).Value =pID Using con Using sda As New SqlDataAdapter() Try cmd.Connection = con Catch ex As Exception Response.Write(&#34;Error&#34; &amp; ex.Message) Finally con.Close() End Try sda.SelectCommand = cmd Using ds As New DataSet() sda.Fill(ds) &#39;output End Using End Using End Using<br /><br />&#39;SECOND SECTION Dim cmd2 As New SqlCommand(&#34;query&#34;, con) Try con.Open() cmd2.ExecuteNonQuery() Dim reader As SqlDataReader = cmd2.ExecuteReader() While reader.Read() Dim rr As String = reader.Item(&#34;dID&#34;).ToString Dim returnedRows As String = reader.FieldCount.ToString() If rr = &#34;True&#34; Then &#39;output ElseIf rr = &#34;False&#34; Then &#39;output End If End While reader.Close() Catch ex As Exception Response.Write(&#34;error&#34; &amp; ex.Message) &#39;Error is beign displayed here: The ConnectionString property has not been initialized Finally con.Close() End Try </pre> <p>The error is coming from the second SQL cmd but if I comment out the first section; the second section runs fine.</p> <p>I must have made another basic error but I just can't figure out what it is. Any help would be great. Thanks.</p>http://www.aspforums.net/Threads/153809/The-ConnectionString-property-has-not-been-initialized-error/http://www.aspforums.net/Threads/153809/The-ConnectionString-property-has-not-been-initialized-error/Wed, 01 Aug 2012 09:54:53 GMTText box validation<p>Which Regex do I use so the user can't enter in all caps in the textbox?</p> <p><strong>I want...</strong></p> <p><strong>Now is the time</strong></p> <p>Don't want this...</p> <p>NOW IS THE TIME</p> <p>&nbsp;</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/561071/Text-box-validation/http://www.aspforums.net/Threads/561071/Text-box-validation/Tue, 14 Feb 2012 05:16:35 GMTShow image without saving<p>Hi,</p> <p>In URL belowyou explain how to show an image without saving it.</p> <p>http://www.aspsnippets.com/Articles/Display-Byte-Array-as-Image-without-using-Generic-Handler-in-ASPNet.aspx</p> <p>I've used this but im experiencing troubles IE 6 &amp; 7 dont show the pic. And IE 8 seems to have a limit of somekind. It there a way to get round this problem ?</p> <p>I have an person screen and a different upload popup-like-screen</p> <p>I want to let the user upload it in this upload-screen and oly save it as the user say's save in the person screen so i don't want to save 1.001 pictures on the server if they don't click save in the person screen.</p> <p>&nbsp;</p> <p>thanks alot</p> <p>Marvin</p>http://www.aspforums.net/Threads/856229/Show-image-without-saving/http://www.aspforums.net/Threads/856229/Show-image-without-saving/Fri, 06 Jul 2012 01:52:58 GMTSystem.NullReferenceException Error when finding control in Row Updating event of ASP.Net GridView<p>i got an error here in below line of code&nbsp; :</p> <p><em>Dim tempID As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("tempID"), Label).Text</em></p> <p>ERROR IS : <span style="font-family: Arial,Helvetica,Geneva,SunSans-Regular,sans-serif;">System.NullReferenceException: Object reference not set to an instance of an object.</span></p> <p>&nbsp;</p> <p>&nbsp;</p> <p>my code is :</p> <p>&nbsp;</p> <p>Protected Sub grdMaster_rowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdMaster.RowUpdating<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim conStr As String = ConfigurationManager.ConnectionStrings("conStr").ConnectionString<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim con1 As SqlConnection = New SqlConnection(conStr)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim tempID As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("tempID"), Label).Text<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim grpName As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("group"), TextBox).Text<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim usrName As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("user"), TextBox).Text<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim str As String = "update MMM_REF_GROUP_USER set grpId=@groupId, usrId=@userId where tempID=@tempId "<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim cmd As SqlCommand = New SqlCommand(str, con1)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@tempId", SqlDbType.Int).Value = tempID<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@grpId", SqlDbType.NVarChar).Value = grpName<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@usrId", SqlDbType.NVarChar).Value = usrName<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grdMaster.EditIndex = -1<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grdMaster.DataSource = GetDataItem(cmd)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grdMaster.DataBind()<br /><br /><br />&nbsp;&nbsp;&nbsp; End Sub</p>http://www.aspforums.net/Threads/441377/SystemNullReferenceException-Error-when-finding-control-in-Row-Updating-event-of-ASPNet-GridView/http://www.aspforums.net/Threads/441377/SystemNullReferenceException-Error-when-finding-control-in-Row-Updating-event-of-ASPNet-GridView/Fri, 06 Jul 2012 09:23:58 GMTSystem.FormatException: Input string was not in a correct format while parsing value to integer and decimal in ASP.Net<p>hi</p> <p>I used below code to conver textbox value to int:</p> <pre class="brush: csharp">if (!IsPostBack) { int rahn2 = int.Parse(Txtrahn2.Text); int rahn1 = int.Parse(Txtrahn1.Text); } </pre> <p>but this error happen:</p> <h1>Server Error in '/' Application.</h1> <hr size="1" width="100%" /> <h2><em>Input string was not in a correct format.</em></h2> <p><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <strong> Description: </strong>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <strong> Exception Details: </strong>System.FormatException: Input string was not in a correct format. <strong>Source Error:</strong> </font></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td> <pre><font color="red">Line 27: int rahn2 = int.Parse(Txtrahn2.Text); </font>Line 28: int rahn1 = int.Parse(Txtrahn1.Text); Line 29: }</pre> </td> </tr> </tbody> </table> <p>Best regards</p> <p>neda</p>http://www.aspforums.net/Threads/152381/SystemFormatException-Input-string-was-not-in-a-correct-format-while-parsing-value-to-integer-and-decimal-in-ASPNet/http://www.aspforums.net/Threads/152381/SystemFormatException-Input-string-was-not-in-a-correct-format-while-parsing-value-to-integer-and-decimal-in-ASPNet/Mon, 27 Mar 2017 11:06:40 GMTStore date which 4 days later than current date and then store in database in ASP.Net<p>if i select the today date</p> <p>then i want store 4days later date in the database</p>http://www.aspforums.net/Threads/174484/Store-date-which-4-days-later-than-current-date-and-then-store-in-database-in-ASPNet/http://www.aspforums.net/Threads/174484/Store-date-which-4-days-later-than-current-date-and-then-store-in-database-in-ASPNet/Tue, 19 Jun 2012 05:34:54 GMTstack overflow<p>hii.. m getting this error..</p> <p>An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll</p> <pre class="brush: vb">Sub randgen() Randomize() rndum = &#34;&#34; Dim i As Integer = 0 For i = 1 To 8 x = Int(Rnd() * 10) rndum = rndum &amp; x Next nameAbbrevation() If nameFlag = 1 Then If ddlLoanScheme.SelectedValue = &#34;Marraige Loan&#34; Then ackid = &#34;MarLn_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Medical Facility&#34; Then ackid = &#34;MediFac_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Business Loan&#34; Then ackid = &#34;BusiLn_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Education Loan&#34; Then ackid = &#34;EduLn_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Home Loan&#34; Then ackid = &#34;HomeLn_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Auto Loan&#34; Then ackid = &#34;AutoLn_&#34; &amp; newword &amp; rndum ElseIf ddlLoanScheme.SelectedValue = &#34;Personal Loan&#34; Then ackid = &#34;PerLn_&#34; &amp; newword &amp; rndum End If Dim cnt1 As Integer = 0 con.Open() cmd = New SqlCommand(&#34;Proc_AddAppDetails&#34;, con) cmd.CommandType = Data.CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter(&#34;@Mode&#34;, Data.SqlDbType.VarChar, 50)) cmd.Parameters.AddWithValue(&#34;@strAppNo&#34;, Replace(Replace(ackid, &#34;&#39;&#34;, &#34;&#39;&#39;&#34;), &#34;&lt;&#34;, &#34;&#34;)) cmd.Parameters(&#34;@Mode&#34;).Value = &#34;chkDupAckwid&#34; cnt1 = cmd.ExecuteScalar() con.Close() If cnt1 = 0 Then ackid = ackid ElseIf cnt1 &gt; 0 Then ackid = &#34;&#34; End If End If If ackid = &#34;&#34; Then randgen() End If End Sub</pre> <p>&nbsp;</p> <p>&nbsp;</p> <p>m getting error at con.Open()</p> <p>pls help</p>http://www.aspforums.net/Threads/103495/stack-overflow/http://www.aspforums.net/Threads/103495/stack-overflow/Mon, 19 Dec 2011 01:43:04 GMTSingle sign on by passing Username and Password in QueryString in ASP.Net<p>HI,</p> <p>I am trying do signle sign on for my application from website without any tool.I thing to pass username and password from website to application in query string.I have to pass session id also or not.Is it necessary to maintain session id in application also.</p> <p>if so how to do it can any one help me</p>http://www.aspforums.net/Threads/251003/Single-sign-on-by-passing-Username-and-Password-in-QueryString-in-ASPNet/http://www.aspforums.net/Threads/251003/Single-sign-on-by-passing-Username-and-Password-in-QueryString-in-ASPNet/Tue, 11 Jul 2017 02:08:05 GMTSignificance of Layers of Three Tier Architecture<p>Can any one explain about 3 tier architecture and n tier architecture.</p> <p>I dont need explanation about the layer but i need what is the flow in 3 tier and n tier architectuere and what each layer contains and what is the responsibilities of each layer.</p> <p>&nbsp;</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/951960/Significance-of-Layers-of-Three-Tier-Architecture/http://www.aspforums.net/Threads/951960/Significance-of-Layers-of-Three-Tier-Architecture/Thu, 26 Jul 2012 07:08:23 GMTSignificance of 5 tier architecture and n tier architecture<p>Hi</p> <p>Can any one explain about 5 tier architecture flow and n tier architecture flow. I need the significance of each layer in both the architecture.</p> <p>&nbsp;Thanks.</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/211873/Significance-of-5-tier-architecture-and-n-tier-architecture/http://www.aspforums.net/Threads/211873/Significance-of-5-tier-architecture-and-n-tier-architecture/Fri, 27 Jul 2012 06:30:25 GMTSet values from database when embedding Flash (SWF) file using EMBED in ASP.Net<p>I have this html code for <strong>embedding a CCTV camera</strong> in my aspx page:</p> <pre class="brush: xml">&lt;object id=&#34;VACtrl2&#34; width=&#34;800&#34; height=&#34;600&#34; classid=&#34;CLSID:70EDCF63-CA7E-4812-8528-DA1EA2FD53B6&#34; codebase=&#34;\VitaminCtrl_4.0.0.8.cab#version=3,0,0,12&#34;&gt; &lt;param name=&#34;ClickEventHandler&#34; value=&#34;1&#34; runat=&#34;server&#34;/&gt; &lt;param id=&#34;Param1&#34; name=&#34;UserName&#34; value=&#34;root&#34; runat=&#34;server&#34;/&gt; &lt;param id=&#34;Param2&#34; name=&#34;Password&#34; value=&#34;&#34; runat=&#34;server&#34;/&gt; &lt;param id=&#34;Param3&#34; name=&#34;RemoteIPAddr&#34; value=&#34;&#34; runat=&#34;server&#34;/&gt; &lt;param id=&#34;Param4&#34; name=&#34;HttpPort&#34; value=&#34;80&#34; runat=&#34;server&#34;/&gt; &lt;param id=&#34;Param5&#34; name=&#34;DisplayErrorMsg&#34; value=&#34;false&#34; runat=&#34;server&#34;/&gt; &lt;/object&gt;</pre> <p>I want to set the 3rd parameters value i.e., <strong>Param3</strong> from my C# code-behind using database table (i.e., the path to the file to be view).</p> <p>This 'Param3' name= 'RemoteIPAddress' field is there in database table (as below)</p> <table border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <td valign="top" width="73"> <p><strong>Id</strong></p> </td> <td valign="top" width="132"> <p><strong>IP Address</strong></p> </td> </tr> <tr> <td valign="top" width="73"> <p>1</p> </td> <td valign="top" width="132"> <p>10.9.84.222</p> </td> </tr> <tr> <td valign="top" width="73"> <p>2</p> </td> <td valign="top" width="132"> <p>100.153.1.1</p> </td> </tr> <tr> <td valign="top" width="73"> <p>3</p> </td> <td valign="top" width="132"> <p>169.254.0.99</p> </td> </tr> <tr> <td valign="top" width="73"> <p>4</p> </td> <td valign="top" width="132"> <p>100.0.1.4</p> </td> </tr> <tr> <td valign="top" width="73"> <p>5</p> </td> <td valign="top" width="132"> <p>169.254.0.90</p> </td> </tr> </tbody> </table> <p>How to achieve it.</p> <p>Please reply.</p> <p><br /><br /></p>http://www.aspforums.net/Threads/146001/Set-values-from-database-when-embedding-Flash-SWF-file-using-EMBED-in-ASPNet/http://www.aspforums.net/Threads/146001/Set-values-from-database-when-embedding-Flash-SWF-file-using-EMBED-in-ASPNet/Tue, 28 Jan 2014 01:59:37 GMTSet MenuItem as Active using CSS class based on URL of the Current Page in ASP.Net<p>Hi,</p> <p>&nbsp; &nbsp; I have a .aspx page where i copied 1 navigation bar. On it i put some link buttons. They are navigating. But when I click it's class should become Active &lt;li class="active"&gt;Home&lt;/li&gt;.&nbsp;If i click on register link button then register's class should become active.&nbsp;</p> <p>&nbsp;</p> <p>Thanks</p>http://www.aspforums.net/Threads/106446/Set-MenuItem-as-Active-using-CSS-class-based-on-URL-of-the-Current-Page-in-ASPNet/http://www.aspforums.net/Threads/106446/Set-MenuItem-as-Active-using-CSS-class-based-on-URL-of-the-Current-Page-in-ASPNet/Thu, 16 Aug 2012 01:58:01 GMT