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
- ExecutionContext.cs
- ManifestBasedResourceGroveler.cs
- ReservationCollection.cs
- InkCollectionBehavior.cs
- HttpModulesSection.cs
- DynamicControl.cs
- TrackingCondition.cs
- SqlConnection.cs
- SectionInformation.cs
- Table.cs
- ISAPIWorkerRequest.cs
- WebSysDefaultValueAttribute.cs
- CryptoApi.cs
- DrawingContextDrawingContextWalker.cs
- CodeDOMUtility.cs
- NetMsmqBinding.cs
- Normalization.cs
- PrintControllerWithStatusDialog.cs
- TaskDesigner.cs
- CodeTypeDeclaration.cs
- StreamGeometry.cs
- ChangeBlockUndoRecord.cs
- BinaryNode.cs
- _emptywebproxy.cs
- SecureUICommand.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- UIElementCollection.cs
- AspNetHostingPermission.cs
- SqlParameterCollection.cs
- PeerCollaborationPermission.cs
- DataGridViewCellStyleEditor.cs
- MemberInfoSerializationHolder.cs
- HttpRuntime.cs
- arabicshape.cs
- PageParserFilter.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- SamlAssertionKeyIdentifierClause.cs
- PageRanges.cs
- RuleRef.cs
- DrawingImage.cs
- MasterPageCodeDomTreeGenerator.cs
- DeviceContext.cs
- SystemDropShadowChrome.cs
- TTSEvent.cs
- ContextMenuAutomationPeer.cs
- TextWriter.cs
- HttpCachePolicyWrapper.cs
- DesignerCalendarAdapter.cs
- WrapperEqualityComparer.cs
- GeneralTransform3DGroup.cs
- SecureStringHasher.cs
- ListViewCommandEventArgs.cs
- TransportSecurityHelpers.cs
- WebException.cs
- PathTooLongException.cs
- ResourceDescriptionAttribute.cs
- GlobalEventManager.cs
- ConnectionPointConverter.cs
- SchemaImporterExtensionsSection.cs
- ScriptResourceAttribute.cs
- EventPropertyMap.cs
- ProfileSettingsCollection.cs
- RepeaterItemEventArgs.cs
- TraceFilter.cs
- PropertySegmentSerializer.cs
- DbConnectionClosed.cs
- VirtualPathExtension.cs
- EntryIndex.cs
- ColorMatrix.cs
- SingleStorage.cs
- EndpointPerformanceCounters.cs
- SafeWaitHandle.cs
- VectorAnimationUsingKeyFrames.cs
- PrincipalPermission.cs
- ValueTable.cs
- dataSvcMapFileLoader.cs
- BrowserTree.cs
- RuntimeDelegateArgument.cs
- NotifyIcon.cs
- TransformedBitmap.cs
- SetStoryboardSpeedRatio.cs
- WinEventQueueItem.cs
- ClientUrlResolverWrapper.cs
- TransformedBitmap.cs
- RoleManagerModule.cs
- DisableDpiAwarenessAttribute.cs
- TextSearch.cs
- AssemblyNameProxy.cs
- TimeSpanSecondsConverter.cs
- ListenerChannelContext.cs
- JournalEntryListConverter.cs
- MaskDescriptors.cs
- AnchorEditor.cs
- JpegBitmapEncoder.cs
- TypedTableBase.cs
- WSHttpBinding.cs
- DbTypeMap.cs
- FontSourceCollection.cs
- HtmlTitle.cs
- KeyEventArgs.cs