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
- AppliedDeviceFiltersEditor.cs
- _KerberosClient.cs
- ReferencedCollectionType.cs
- FocusChangedEventArgs.cs
- GlyphShapingProperties.cs
- TextTreeUndo.cs
- TextBounds.cs
- ReadOnlyPropertyMetadata.cs
- ImportContext.cs
- PropertyDescriptorComparer.cs
- WebPartTransformerCollection.cs
- ApplicationProxyInternal.cs
- NamedObjectList.cs
- AsyncOperation.cs
- EventLevel.cs
- DataListItem.cs
- XdrBuilder.cs
- MenuItemAutomationPeer.cs
- ApplicationActivator.cs
- ObjectDisposedException.cs
- WebPartVerb.cs
- UnhandledExceptionEventArgs.cs
- ClientApiGenerator.cs
- BuildManager.cs
- GiveFeedbackEventArgs.cs
- ListSortDescriptionCollection.cs
- CapabilitiesState.cs
- DynamicRenderer.cs
- FunctionImportElement.cs
- WorkflowInstanceProxy.cs
- DataDocumentXPathNavigator.cs
- Size.cs
- OleDbDataAdapter.cs
- OdbcException.cs
- AuthenticationModuleElementCollection.cs
- FrameworkElement.cs
- TraceAsyncResult.cs
- DataSourceProvider.cs
- ExpressionBuilderContext.cs
- SafeEventHandle.cs
- AccessDataSource.cs
- DataGridViewDataConnection.cs
- IDispatchConstantAttribute.cs
- WindowsListViewItemCheckBox.cs
- ItemCollectionEditor.cs
- InfoCardSymmetricAlgorithm.cs
- MediaEntryAttribute.cs
- LinkButton.cs
- ListViewUpdatedEventArgs.cs
- DesignerVerb.cs
- CodeDefaultValueExpression.cs
- HighlightVisual.cs
- Win32SafeHandles.cs
- CuspData.cs
- TreeNodeSelectionProcessor.cs
- AppendHelper.cs
- ScrollBarRenderer.cs
- Registry.cs
- DataGridViewColumnConverter.cs
- ClientRolePrincipal.cs
- EnterpriseServicesHelper.cs
- xmlNames.cs
- CodeDirectionExpression.cs
- XmlnsCompatibleWithAttribute.cs
- EntityClientCacheKey.cs
- ControlValuePropertyAttribute.cs
- CngUIPolicy.cs
- XmlReturnWriter.cs
- XmlSerializationReader.cs
- bidPrivateBase.cs
- DatatypeImplementation.cs
- HttpClientCertificate.cs
- SerializationSectionGroup.cs
- BitmapDecoder.cs
- TextLineResult.cs
- BooleanToVisibilityConverter.cs
- ProviderUtil.cs
- ManipulationDeltaEventArgs.cs
- SchemaAttDef.cs
- ProfessionalColors.cs
- GifBitmapEncoder.cs
- ValueSerializer.cs
- CodeSubDirectory.cs
- MetaTable.cs
- StorageSetMapping.cs
- CompatibleIComparer.cs
- CodeDirectionExpression.cs
- BehaviorDragDropEventArgs.cs
- XmlSchemaSimpleContentRestriction.cs
- COAUTHINFO.cs
- fixedPageContentExtractor.cs
- DispatcherExceptionFilterEventArgs.cs
- CompoundFileIOPermission.cs
- GridViewAutoFormat.cs
- CrossAppDomainChannel.cs
- IgnoreFileBuildProvider.cs
- UnionCodeGroup.cs
- _DigestClient.cs
- OletxDependentTransaction.cs
- QuaternionKeyFrameCollection.cs