Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Security / AuthenticationService.cs / 1305376 / 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
- Trace.cs
- _ListenerAsyncResult.cs
- XmlAttributeOverrides.cs
- TdsParser.cs
- SecurityTokenException.cs
- DataContractSerializerServiceBehavior.cs
- EndOfStreamException.cs
- EnterpriseServicesHelper.cs
- ClrProviderManifest.cs
- ErrorHandler.cs
- DeviceSpecificDesigner.cs
- OdbcErrorCollection.cs
- BamlRecordReader.cs
- TextUtf8RawTextWriter.cs
- DynamicActivityProperty.cs
- ErrorHandler.cs
- FloatUtil.cs
- CharEntityEncoderFallback.cs
- DropTarget.cs
- DbSource.cs
- DataObjectFieldAttribute.cs
- ScrollPattern.cs
- HtmlLinkAdapter.cs
- DeflateEmulationStream.cs
- DesignDataSource.cs
- MenuItemStyleCollectionEditor.cs
- SQLStringStorage.cs
- PrinterSettings.cs
- StateRuntime.cs
- SafeThreadHandle.cs
- SqlCacheDependencySection.cs
- ChangePassword.cs
- QilFunction.cs
- ILGen.cs
- KnownTypeHelper.cs
- GenericEnumConverter.cs
- ServiceDeploymentInfo.cs
- EntitySqlQueryCacheEntry.cs
- BaseValidator.cs
- PolygonHotSpot.cs
- ControlParameter.cs
- DeferredElementTreeState.cs
- RawAppCommandInputReport.cs
- assemblycache.cs
- XPathMessageFilter.cs
- CommonRemoteMemoryBlock.cs
- CommandDevice.cs
- Translator.cs
- GlyphRunDrawing.cs
- StateWorkerRequest.cs
- ISCIIEncoding.cs
- DetailsViewUpdateEventArgs.cs
- InputReportEventArgs.cs
- MetadataUtilsSmi.cs
- EntityContainerAssociationSet.cs
- Semaphore.cs
- DataGridCaption.cs
- CrossAppDomainChannel.cs
- PopupRoot.cs
- XamlWrappingReader.cs
- CriticalFinalizerObject.cs
- SymLanguageVendor.cs
- ThreadNeutralSemaphore.cs
- Viewport3DVisual.cs
- ConfigPathUtility.cs
- Visual3DCollection.cs
- StickyNote.cs
- HttpProtocolImporter.cs
- InvokePatternIdentifiers.cs
- CompModSwitches.cs
- XPathNodeIterator.cs
- SqlCommand.cs
- IndexOutOfRangeException.cs
- DSACryptoServiceProvider.cs
- DynamicMetaObject.cs
- XmlAttributeCollection.cs
- ContentControl.cs
- PropertyTabAttribute.cs
- DataGridPageChangedEventArgs.cs
- InfoCardTraceRecord.cs
- XmlReaderSettings.cs
- WebConfigurationManager.cs
- XmlWrappingReader.cs
- RuleRef.cs
- EdmEntityTypeAttribute.cs
- TemplateParser.cs
- DirectoryInfo.cs
- DesignSurfaceCollection.cs
- WindowsToolbarItemAsMenuItem.cs
- MemoryMappedFile.cs
- KeyConverter.cs
- PageThemeCodeDomTreeGenerator.cs
- AdRotatorDesigner.cs
- NativeMethods.cs
- ExtensionWindow.cs
- PluralizationService.cs
- Perspective.cs
- DropShadowBitmapEffect.cs
- ImportCatalogPart.cs
- PixelFormats.cs