c#

How to use ASP.NET Membership class to retrieve users from the store in C#

If you want to retrieve a single user and a list of users through the Membership class from the membership store, you can create a simple page with a GridView control for binding the users to the grid, as follows:

<html xmlns=”https://www.w3.org/1999/xhtml”>

<head runat=”server”>

<title>Display Users Page</title>

</head>

<body>

<form id=”form1″ …

Learn more

How to use ASP.NET Membership CreateUserWizard control events in C#

You can use the approach explained in the article How to use ASP.NET Membership CreateUserWizard control to create additional wizard steps. In this case you need to handle events and perform some actions within event procedures. For example if you are planning to collect additional information from the user with the wizard, you have to store …

Learn more

How to program the ASP.NET Membership Login control in C#

The ASP.NET membership Login control supports several events and properties and you can use them to customize its behavior. The Login control supports the next events:

Event

Description

LoggingIn
Raised before the user gets authenticated by the control.

Authenticate

Raised to authenticate the user. If you handle this event, you have to authenticate the user on …

Learn more

How to use Persistent Cookies with Forms Authentication in ASP.NET in C#

Usually you will use in your projects nonpersistent authentication cookie to maintain the authentication ticket between requests. This means that if the user closes the browser, the cookie is immediately removed. The benefits are the following:

– This is a sensible step that ensures security. It’s particularly important with shared computers to prevent …

Learn more

How to use Forms Authentication custom credentials store in ASP.NET in C#

The credential store in web.config (described in the articles How to use web.config as credential store with Forms Authentication in ASP.NET and How to hash ASP.NET Forms Authentication passwords in web.config in C# ) is useful for simple scenarios only.  You have not use web.config as the credential store, because:

– Potential lack of security: …

Learn more

How to hash ASP.NET Forms Authentication passwords in web.config in C#

Forms authentication offers the possibility of storing the password in different formats. In the <credentials /> configuration section of the <forms /> element, the format of the password is specified through the passwordFormat attribute, which has three valid values:

– Clear – The passwords are stored as clear text in the <user /> …

Learn more

How to create a Forms Authentication logout page in ASP.NET in C#

You can create a Forms Authentication logout page by creating a logout button and calling the FormsAuthentication.SignOut() method, as shown here:

protected void SignOutAction_Click(object sender, EventArgs e)

{

FormsAuthentication.SignOut();

FormsAuthentication.RedirectToLoginPage();

}

When you call the SignOut() method, you remove the authentication cookie. Depending on the application, you can redirect the user to another page when the user logs …

Learn more

How to create a Forms Authentication custom login page in ASP.NET in C#

When you want to implement Forms Authentication in your web application you have to create a custom login page. This page collects user name and password from the user and validates them against the credentials stored in the credential store. You can store credentials in web.config as described in the article How to use web.config as …

Learn more

How to validate XML document with XDocument class in C#

When you want to validate an XML document against a schema, by using XDocument you need to import the System.Xml.Schema namespace. In this way you can use validation classes which XDocument class doesn’t have. The imported namespace contains an Extensions class that include a Validate() method you can use on an XElement or XDocument.

Note: You can …

Learn more