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
- XmlnsDictionary.cs
- Encoding.cs
- ToolStripItemImageRenderEventArgs.cs
- ToolStripSeparator.cs
- NetworkCredential.cs
- Keywords.cs
- ListenerHandler.cs
- DeviceContexts.cs
- EntityException.cs
- BehaviorEditorPart.cs
- ExpandCollapsePattern.cs
- WebPartConnectionsConnectVerb.cs
- SessionState.cs
- ImageIndexConverter.cs
- SignatureDescription.cs
- DataGridViewRowPrePaintEventArgs.cs
- XslCompiledTransform.cs
- WindowsListView.cs
- SourceFileInfo.cs
- ConfigurationValues.cs
- HostSecurityManager.cs
- ListViewCancelEventArgs.cs
- ToolStripLabel.cs
- GPPOINTF.cs
- ObjectQueryExecutionPlan.cs
- TargetControlTypeCache.cs
- ContextMenu.cs
- AutoCompleteStringCollection.cs
- SettingsBindableAttribute.cs
- SplitContainer.cs
- IdentityNotMappedException.cs
- InkCanvasSelection.cs
- Brush.cs
- SystemIcmpV6Statistics.cs
- SchemaConstraints.cs
- PackageDigitalSignatureManager.cs
- XmlAttribute.cs
- ScrollItemPattern.cs
- PauseStoryboard.cs
- ObjectCloneHelper.cs
- DataControlPagerLinkButton.cs
- PlatformCulture.cs
- CharacterMetrics.cs
- DateTimeOffsetConverter.cs
- SoapDocumentServiceAttribute.cs
- MetadataArtifactLoaderResource.cs
- StoreItemCollection.Loader.cs
- TimeSpanValidator.cs
- EventSetterHandlerConverter.cs
- QueryAsyncResult.cs
- CacheForPrimitiveTypes.cs
- CodeTypeOfExpression.cs
- XmlNamespaceManager.cs
- TransformerInfo.cs
- SoapInteropTypes.cs
- DataViewManager.cs
- UIntPtr.cs
- XmlDsigSep2000.cs
- FilteredSchemaElementLookUpTable.cs
- QueryInterceptorAttribute.cs
- ByteStack.cs
- ButtonFlatAdapter.cs
- StrongNameIdentityPermission.cs
- EdmItemCollection.OcAssemblyCache.cs
- BaseTemplateCodeDomTreeGenerator.cs
- exports.cs
- HasRunnableWorkflowEvent.cs
- DetailsViewPageEventArgs.cs
- FontWeightConverter.cs
- DataSourceXmlSerializationAttribute.cs
- DoubleConverter.cs
- TextServicesManager.cs
- ImplicitInputBrush.cs
- RowBinding.cs
- ControlPropertyNameConverter.cs
- MethodMessage.cs
- OutputCacheProfileCollection.cs
- DatatypeImplementation.cs
- Debug.cs
- ParserOptions.cs
- ApplicationHost.cs
- PersonalizationStateInfo.cs
- VolatileResourceManager.cs
- MemberInitExpression.cs
- FunctionUpdateCommand.cs
- IdentityReference.cs
- BaseTemplateParser.cs
- AtomServiceDocumentSerializer.cs
- ServerValidateEventArgs.cs
- DiagnosticStrings.cs
- DataProtection.cs
- SystemIcons.cs
- CheckBoxAutomationPeer.cs
- MobileFormsAuthentication.cs
- HttpContextBase.cs
- MsmqIntegrationOutputChannel.cs
- configsystem.cs
- EventListener.cs
- DbTypeMap.cs
- TickBar.cs