Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Security / AuthenticationService.cs / 1 / AuthenticationService.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Security { using System.Web.ApplicationServices; using System.Web.Script.Services; using System.Web.Services; [ScriptService] internal sealed class AuthenticationService { [WebMethod] public bool Login(string userName, string password, bool createPersistentCookie) { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, true); // if(Membership.ValidateUser(userName, password)) { FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); return true; } return false; } [WebMethod] public void Logout() { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false); FormsAuthentication.SignOut(); } [WebMethod] public bool IsLoggedIn() { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false); return HttpContext.Current.Request.IsAuthenticated; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Security { using System.Web.ApplicationServices; using System.Web.Script.Services; using System.Web.Services; [ScriptService] internal sealed class AuthenticationService { [WebMethod] public bool Login(string userName, string password, bool createPersistentCookie) { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, true); // if(Membership.ValidateUser(userName, password)) { FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); return true; } return false; } [WebMethod] public void Logout() { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false); FormsAuthentication.SignOut(); } [WebMethod] public bool IsLoggedIn() { ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false); return HttpContext.Current.Request.IsAuthenticated; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DateTime.cs
- GlobalizationAssembly.cs
- ArrayTypeMismatchException.cs
- DataGridViewColumnCollection.cs
- ListViewItemMouseHoverEvent.cs
- AuthenticationConfig.cs
- DbConnectionPoolGroupProviderInfo.cs
- ConfigurationStrings.cs
- ProcessHostFactoryHelper.cs
- OdbcFactory.cs
- BinHexEncoder.cs
- CommandHelper.cs
- RadioButtonStandardAdapter.cs
- FileStream.cs
- CodeNamespaceImport.cs
- DesignTimeVisibleAttribute.cs
- UpdatePanelTrigger.cs
- mediaeventargs.cs
- PropertyConverter.cs
- IntranetCredentialPolicy.cs
- AssertSection.cs
- InlineCategoriesDocument.cs
- HttpsHostedTransportConfiguration.cs
- XmlArrayItemAttribute.cs
- SystemInformation.cs
- RuleInfoComparer.cs
- X509Extension.cs
- ContractAdapter.cs
- Site.cs
- X509SubjectKeyIdentifierClause.cs
- ActionFrame.cs
- WebServiceHandlerFactory.cs
- BitmapCodecInfo.cs
- ImageCodecInfo.cs
- FixedHyperLink.cs
- PermissionAttributes.cs
- AssociationSetEnd.cs
- ProviderConnectionPointCollection.cs
- ExpressionBuilderCollection.cs
- UrlAuthorizationModule.cs
- InternalBufferOverflowException.cs
- ISAPIRuntime.cs
- EntityDataSourceView.cs
- XmlDataContract.cs
- ISFTagAndGuidCache.cs
- XmlName.cs
- IsolatedStorageFile.cs
- ColorKeyFrameCollection.cs
- PkcsUtils.cs
- JsonEnumDataContract.cs
- CatalogZoneAutoFormat.cs
- DataColumnMappingCollection.cs
- ControlBuilder.cs
- WebPartsPersonalization.cs
- SiteOfOriginContainer.cs
- AggregateException.cs
- DataControlPagerLinkButton.cs
- GenericPrincipal.cs
- SwitchLevelAttribute.cs
- DataBoundControlHelper.cs
- ParameterToken.cs
- ScriptingWebServicesSectionGroup.cs
- XmlNamespaceMappingCollection.cs
- DataFieldConverter.cs
- SecureUICommand.cs
- PageContentCollection.cs
- DataGridTableCollection.cs
- DbExpressionVisitor.cs
- IsolatedStorageFile.cs
- AsyncCompletedEventArgs.cs
- DiagnosticsConfigurationHandler.cs
- ToolStripDropDownItem.cs
- safex509handles.cs
- FormViewUpdateEventArgs.cs
- CompileLiteralTextParser.cs
- ApplicationTrust.cs
- KnownBoxes.cs
- FeedUtils.cs
- WebControlToolBoxItem.cs
- NonParentingControl.cs
- KoreanCalendar.cs
- HostProtectionPermission.cs
- PageOutputQuality.cs
- XmlSerializerSection.cs
- InvalidAsynchronousStateException.cs
- FunctionGenerator.cs
- ButtonBaseAdapter.cs
- DragCompletedEventArgs.cs
- SetState.cs
- NameTable.cs
- MatrixStack.cs
- Utility.cs
- DoubleLinkListEnumerator.cs
- dbenumerator.cs
- DataGridViewRowEventArgs.cs
- RenderOptions.cs
- UrlPath.cs
- MenuItemStyleCollection.cs
- DataRecord.cs
- ConfigurationPermission.cs