Tag - ASP.NET

How to use Active Directory Membership Provider in ASP.NET

The ASP.NET membership feature provides secure credential storage for application users. We will use The following: Web page named Login.aspx and another web page named CreateUser.aspx Login Control. Create User Wizard Control. Steps: 1- Configure Forms Authentication in Web.config file. To configure forms authentication, set the <authentication> element's mode attribute to "Forms" and then configure your application's Web.config file as shown...

How to use SQL Membership Provider in ASP.NET

The ASP.NET membership feature provides secure credential storage for application users. We will use the following: Web Page Named Login.aspx and another Web Page named CreateUser.aspxLogin Control.Create User Wizard Control. Steps: 1- Configure Forms Authentication in Web.config File To configure forms authentication, set the <authentication> element's mode attribute to "Forms" and then configure your application's Web.config file as shown...

How to allow paging in Repeater control in ASP.NET

I'll show you how to make a repeater that allow paging, also I'll make it as a web user control so anyone can just use it right away. Steps: 1- Create a web user control using C# and rename it to RepeaterPager. 2- Add four buttons and one label:Control Name Text Button btnNext >Button btnPrevious <Button btnLastRecord >>Button...

Custom validator scrolls page to the top in ASP.NET

If we add a ValidationSummary control to the page, its ValidationSummaryOnSubmit function invokes “window.scrollTo(0,0)” when page is invalid. That’s why the page scrolls to the top. To workaround this issue, we can assign a function to window.scrollTo which do nothing, so that window.scrollTo(0,0) will not take effect. This workaround is appropriate for the pages which...

How to pass authentication between two ASP.NET applications

If you have two web applications and every application hosted in a separated server, also every web application has login page, so how we can save our credentials once we logged in first web application and if we want to go to the second application without the second application request my authentication again. There are...

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack ASP.NET

While I was debugging an ASP.NET Application, I wanted to get an object values I got this error message instead: "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack" This problem occurs when using Response.Redirect or Server.Transfer method, because the Response.End method ends the page execution...

Adding the specified count to the semaphore would cause it to exceed its maximum count

I got this unusual exception while working on an ASP.NET project:"Adding the specified count to the semaphore would cause it to exceed its maximum count error". I thought it is something related to SQL Server Database Connection String.After using Query Profiler I was able to run SQL queries directly without any problems.So this means that...

How to disable some context menu items on Telerik TreeView

There is an event named "OnClientContextMenuShowing" for Rad Treeview that calls javascipt function and passes 2 arguments "sender, args".The Args parameter contains The current selected TreeNode and Context Menu Items.You can enable or disable any Context menu item based on any attributes for the Current Selected Tree Node. Here is a code snippet for the...

How to programmatically create iFrame in ASP.NET

Sometimes we may need to create iFrames and use it within GridView or Repeater, and we want to pass some values to it.This example will show you how to create iFrame Programmatically and add it to a PlaceHolder. HtmlGenericControl myFrame = new HtmlGenericControl(); myFrame.TagName = "IFRAME"; myFrame.Attributes["src"] = "MyPagePath"; myFrame.Attributes["id"] = "myFrame1"; myFrame.Attributes["name"] = "myFrame1"; myFrame.Attributes["width"] = "500"; myFrame.Attributes["height"] = "500"; myFrame.Attributes["class"] =...

Operation is not valid due to the current state of the object exception in ASP.NET

I got this error when I tried to save a Page with lots of form fields to SQL Server Database.The default max number of form fields that can be post is 1000.In order to solve this error add this Line to your Web.Config File: <appSettings> <add key="aspnet:MaxHttpCollectionKeys" value="10000" /> </appSettings>