.NET Samples - ASP.NET Security
This section includes the following samples:
SoapHeaders Sample
Forms-Based/Cookie Authentication with URL Authorization Sample
Forms-Based/Cookie Authentication Sample
Windows Authentication Sample
SoapHeaders Sample
This sample demonstrates how SOAP headers can be used to pass authentication credentials to an XML Web service.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System; System.Web; System.Web.Services; System.Web.Services.Protocols
Classes used in this sample:
Header; SoapHeader; Service; WebService; Stack; Object; Exception; Trace; StackTrace; Page; Import; EventArgs
Forms-Based/Cookie Authentication with URL Authorization Sample
This sample demonstrates authorization roles defined in an ASP.NET configuration file to restrict or allow access to an application. The sample also demonstrates forms-based authentication using the FormsAuthentication helper class in ASP.NET.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Web; System; System.Web.Security
Classes used in this sample:
Cookie; Page; EventArgs; Object; Message; Font; FormsAuthentication; Form; RequiredFieldValidator; Control; Import; CheckBox; Label
Forms-Based/Cookie Authentication Sample
This sample demonstrates forms-based authentication using the FormsAuthentication helper class in ASP.NET.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
System.Web; System; System.Web.Security
Classes used in this sample:
Cookie; Page; EventArgs; Object; Message; Font; FormsAuthentication; Form; RequiredFieldValidator; Control; Import; CheckBox; Label
Windows Authentication Sample
This sample shows how to access the name of an authenticated user, which is available as User.Identity.Name. Programmers familiar with ASP should note that this value is also still available as the AUTH_USER server variable.
Link to the online sample documentation
Link to the online sample source code
Namespaces used in this sample:
(none)
Classes used in this sample:
Type; Page; Object; EventArgs