Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- NestedContainer.cs
- WebPartZoneCollection.cs
- Configuration.cs
- InputMethodStateTypeInfo.cs
- ExpressionCopier.cs
- PolyBezierSegment.cs
- X509CertificateInitiatorServiceCredential.cs
- Cursor.cs
- FormatVersion.cs
- OdbcErrorCollection.cs
- EntityDataSourceWrapper.cs
- ModuleBuilderData.cs
- ProtocolElement.cs
- ListBindingConverter.cs
- GridViewRowEventArgs.cs
- SoapHeaderException.cs
- ClientFormsAuthenticationCredentials.cs
- SEHException.cs
- ObjectList.cs
- TargetException.cs
- XmlSchemaChoice.cs
- StaticSiteMapProvider.cs
- SQLBytes.cs
- NativeMethodsOther.cs
- WindowPatternIdentifiers.cs
- UserControlFileEditor.cs
- ExpressionNormalizer.cs
- DecoderNLS.cs
- ProviderConnectionPoint.cs
- AppearanceEditorPart.cs
- AnnotationResource.cs
- Command.cs
- UnregisterInfo.cs
- FontFamily.cs
- DocumentSequenceHighlightLayer.cs
- NativeMethods.cs
- URLAttribute.cs
- PtsHost.cs
- MatrixUtil.cs
- ValidatorCollection.cs
- ZipIOCentralDirectoryFileHeader.cs
- PropertyDescriptors.cs
- PerspectiveCamera.cs
- MenuItem.cs
- VisualTreeHelper.cs
- SchemaTableColumn.cs
- TextEditorLists.cs
- EventLogConfiguration.cs
- securitycriticaldataClass.cs
- ListenerSessionConnection.cs
- SessionIDManager.cs
- TypeHelper.cs
- BitmapImage.cs
- FilterException.cs
- WrappedIUnknown.cs
- ToolStripSplitButton.cs
- TargetException.cs
- FixedSOMLineCollection.cs
- TextLineResult.cs
- SingleTagSectionHandler.cs
- FaultReason.cs
- RegexCharClass.cs
- _ListenerRequestStream.cs
- OpenTypeLayout.cs
- StickyNoteAnnotations.cs
- ListBindingConverter.cs
- DiscoveryDefaults.cs
- MSHTMLHost.cs
- SapiRecoContext.cs
- PathSegmentCollection.cs
- RenamedEventArgs.cs
- LocalValueEnumerator.cs
- FormsAuthenticationEventArgs.cs
- SerTrace.cs
- MulticastOption.cs
- CharEntityEncoderFallback.cs
- DbMetaDataCollectionNames.cs
- HwndTarget.cs
- DeliveryRequirementsAttribute.cs
- XPathDocumentIterator.cs
- OleDbPropertySetGuid.cs
- MSAANativeProvider.cs
- AsyncResult.cs
- MultiSelectRootGridEntry.cs
- FacetChecker.cs
- GroupDescription.cs
- SRGSCompiler.cs
- UserControl.cs
- SizeAnimationUsingKeyFrames.cs
- ZoneIdentityPermission.cs
- UriParserTemplates.cs
- DataSourceHelper.cs
- entityreference_tresulttype.cs
- XDRSchema.cs
- Comparer.cs
- StretchValidation.cs
- OdbcParameterCollection.cs
- DataServiceRequestException.cs
- InstalledFontCollection.cs
- EdmProviderManifest.cs