Skip to main content

Posts

Showing posts with the label user

How to use LoggedInTemplate and AnonymousTemplate in LoginView

LoggedInTemplate and AnonymousTemplate in LoginView Control LoginView is an asp.net web server control. LoginView control displays the appropriate content template for a given user, based on the user authentication status and role membership. The LoginView control includes two templated views that are displayed to the user. Those are AnonymousTemplate and LoggedInTemplate. AnonymousTemplate is displayed to the users who are not logged in. Anonymous users are those who are not logged in. LoggedInTemplete is displayed for logged-in users only. We can also create templates for the members of particular logged-in role groups. The following asp.net example code demonstrates to us how can we create different templates for authenticated users and anonymous users in an asp.net application. In the below example code, we created two templates view for authenticated users and anonymous users. When authenticated users visit the specified page, they...

How to use ChangePassword control in asp.net

ChangePassword Web Server Control ChangePassword is an ASP.NET web server control. ChangePassword control enables website users to change the passwords they use to log in to the website. ChangePassword server control uses the membership provider defined by the MembershipProvider property to change the password stored in the membership provider data store. ChangePassword control uses the default membership provider if a membership provider does not assign by web developers. We can configure ChangePassword control to use email services to send the new password to the user. To send users a new password to their email address, we must configure an email server in the Web.config file for an ASP.NET application. ChangePassword control has two states or views, the change password view and the success view. The change password view requests the current password and requires inputting the new password twice. The success views display confirmation t...

How to login users programmatically in asp.net

Login user programmatically In .net framework Membership class’s ValidateUser() method allows us to programmatically verify the supplied username and password are valid. The Membership class’s ValidateUser(username, password) method exists under the System.Web.Security namespace. This method requires passing two parameters. The first parameter name is 'username' and another parameter name is 'password'. Both parameters’ data type is String. The username parameter value passes the name of the user to be validated and the password parameter value passes the password for the specified user. If the username parameter is null or empty then this method throws an HttpException. This method returns a Boolean value. If the supplied username and password are valid then it returns True, otherwise, it returns false. In this example code, we manually build a login page without Login server control. This login page contains two TextBoxes...

How to show login status in asp.net

LoginStatus Web Server Control .NET framework LoginStatus Class allows us to detect the user's authentication state and toggles the state of a link to log in to or log out of a website. To allow users to log in to an ASP.NET application that uses forms authentication, we can use the LoginStatus server control to detect a user authentication status. When this control found a user is not authenticated then it displays a Button to move the user to the login page. If the control found a login user then it displays a logout button for this user to log out from the website. We can customize the default look and feel of LoginStatus control by setting its various properties such as BackColor, ForeColor, BorderStyle, BorderColor, BorderWidth, CssClass, Font, Height, Width, etc. LoginStatus control's LoginImageUrl property allows us to set the URL of the image used for the login page link. LoginText property set the text display for the logi...

How to show login name in asp.net

Show login name in asp.net LoginName is an ASP.NET web server control. LoginName control allows us to display a user's login name if the user has logged in using ASP.NET membership. If the site uses integrated windows authentication, the LoginName control displays the user's windows account name. LoginName class allows us to display System.Web.UI.Page.User.Identity.Name property value. LoginName class exists in System.Web.UI.WebControls namespace. LoginName control has many useful built-in properties to provide a better user experience such as AccessKey, BackColor, BorderColor, Attributes, BorderStyle, BorderWidth, CssClass, Font, ForeColor, FormatString, HasAttributes, Height, IsEnabled, Page, Parent, SkinID, Style, TabIndex, TagKey, ToolTip, ViewState, Visible, Width, etc. LoginName control has a few events such as DataBinding, Disposed, Int, Load, PreRender, and Unload. LoginName class’s FormatString property allows us to ...

How to create Login page in asp.net

Login Web Server Control In an asp.net application, we can create a user login page by using Login web server control. This Login control displays a user interface for user authentication. Login control renders two TextBoxes to input username and password. It also displays a CheckBox that allows users to indicate whether they want the server to store their identity for the next visit. It allows users to be automatically authenticated for the next visit. The Login control has many useful built-in properties to customize it. We can change the default look and feel of the login page by using the Login control's BackColor, BorderColor, BorderWidth, BorderStyle, CheckBoxStyle, CreateUserIconUrl, CreateUserText, CreateUserUrl, CssClass, Font, ForeColor, FailureTextStyle, Height, HelpPageIconUrl, LayoutTemplate, TextBoxStyle, TitleTextStyle, LabelStyle, InstructionTextStyle, HyperLinkStyle, LoginButtonStyle, ValidatorTextStyle, BorderPadding, and many mo...