WebSecurity IsAuthenticated Property
-- Learning not just technology, but dreams!
ASP.NET Tutorial
ASP.NET Tutorial | ASP.NET Introduction
WP Tutorial
WebPages Introduction | WebPages Razor | WebPages Layout | WebPages Folders | WebPages Global | WebPages Forms | WebPages Objects | WebPages Files | WebPages Helpers | WebPages WebGrid | WebPages Chart | WebPages Email | WebPages PHP | WebPages Publish | WebPages Examples
WP Reference
WebPages Classes | WebPages Security | WebPages Database | WebPages WebMail | WebPages Helpers
ASP.NET Razor
Razor Introduction | Razor Syntax | Razor C# Variables | Razor C# Loops | Razor C# Logic | Razor VB Variables | Razor VB Loops | Razor VB Logic
ASP.NET MVC
MVC Introduction | MVC Application | MVC Folders | MVC Layout | MVC Controllers | MVC Views | MVC Database | MVC Models | MVC Security | MVC HTML Helpers | MVC Publish | MVC Reference
WF Tutorial
WebForms Introduction | WebForms Pages | WebForms Controls | WebForms Events | WebForms Forms | WebForms ViewState | WebForms TextBox | WebForms Button | WebForms Data Binding | WebForms ArrayList | WebForms Hashtable | WebForms SortedList | WebForms XML Files | WebForms Repeater | WebForms DataList | WebForms Database Connection | WebForms Master Pages | WebForms Navigation | WebForms Examples
WF Reference
WebForms HTML | WebForms Controls | WebForms Validation
WebSecurity Property - IsAuthenticated
Definition
The IsAuthenticated property is a boolean value that indicates whether the current user has been authenticated (is logged in).
If the current user is authenticated, the property value is the boolean true; otherwise, it is false.
C# and VB Syntax
WebSecurity.IsAuthenticated
Examples
Example C#
if (!WebSecurity.IsAuthenticated)
{
Response.Redirect("~/Account/Login");
}
Example VB
if !WebSecurity.IsAuthenticated then
Response.Redirect("~/Account/Login")
end if
Remarks
The IsAuthenticated property is read-only. It cannot be changed through code.
Errors and Exceptions
Under the following circumstances, any access to the WebSecurity object will throw an InvalidOperationException:
- The InitializeDatabaseConnection() method has not been called.
- SimpleMembership is not initialized (or is disabled in the site configuration).
Technical Data
| Name | Value |
|---|---|
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |
ASP.NET Web Pages Class Reference
ASP.NET Web Pages Database Reference
ByteArk Coding Plan supports mainstream large models like Doubao, GLM, DeepSeek, Kimi, MiniMax, officially supplied, stable and reliable.
iFlytek Star Coding Plan includes free model call quotas, DeepSeek, GLM, Kimi, MiniMax, a one-stop experience and deployment platform. Configuration Guide Β₯3.9/month - Subscribe Now
Click to Share Notes
Write notes...
Image URL:
Image Description:
Image Size: Γ Restore
- Nickname:
- Email:
- Reference URL:
YouTip