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
- SessionEndingCancelEventArgs.cs
- FixedPageProcessor.cs
- HttpResponseHeader.cs
- HelpProvider.cs
- Cursor.cs
- FeatureAttribute.cs
- GestureRecognitionResult.cs
- ToolStripMenuItem.cs
- Utility.cs
- NullableLongMinMaxAggregationOperator.cs
- WebPartConnectionsEventArgs.cs
- NavigationProperty.cs
- PropertyContainer.cs
- HMACSHA512.cs
- TextCompositionManager.cs
- StrokeFIndices.cs
- DataGridCommandEventArgs.cs
- HostProtectionPermission.cs
- QuotedPrintableStream.cs
- ClockController.cs
- KerberosSecurityTokenAuthenticator.cs
- DesignTimeVisibleAttribute.cs
- ScalarConstant.cs
- DataObjectMethodAttribute.cs
- DataServiceRequestArgs.cs
- UserControl.cs
- PrintingPermission.cs
- HttpListener.cs
- TextOnlyOutput.cs
- BatchStream.cs
- KnownTypes.cs
- RemotingServices.cs
- BuilderInfo.cs
- KnownIds.cs
- DrawToolTipEventArgs.cs
- ReverseComparer.cs
- SoapTypeAttribute.cs
- MinMaxParagraphWidth.cs
- Size.cs
- ElementProxy.cs
- CodeTryCatchFinallyStatement.cs
- WorkflowEnvironment.cs
- DeviceContext2.cs
- RsaElement.cs
- CodeLabeledStatement.cs
- TextEffectResolver.cs
- WSHttpBindingBaseElement.cs
- DesignerActionVerbItem.cs
- filewebresponse.cs
- SslStream.cs
- TransformProviderWrapper.cs
- relpropertyhelper.cs
- MenuBindingsEditor.cs
- UInt32Storage.cs
- MobilePage.cs
- IncrementalCompileAnalyzer.cs
- Durable.cs
- ToolStripScrollButton.cs
- SymbolType.cs
- RelationshipFixer.cs
- CollectionChangedEventManager.cs
- HostExecutionContextManager.cs
- ContentPlaceHolder.cs
- TileModeValidation.cs
- TextWriterTraceListener.cs
- XmlCharCheckingReader.cs
- QEncodedStream.cs
- ClockController.cs
- NotificationContext.cs
- SQLUtility.cs
- HttpHandlersSection.cs
- WebPartVerb.cs
- CompModHelpers.cs
- ReachObjectContext.cs
- CompilerState.cs
- InitializationEventAttribute.cs
- XmlILAnnotation.cs
- PageCodeDomTreeGenerator.cs
- MinimizableAttributeTypeConverter.cs
- BitmapSourceSafeMILHandle.cs
- BaseDataListPage.cs
- _HTTPDateParse.cs
- ByteArrayHelperWithString.cs
- AppDomainUnloadedException.cs
- MultiByteCodec.cs
- TransformationRules.cs
- FlowLayoutSettings.cs
- FunctionImportMapping.cs
- ArrayWithOffset.cs
- ToolStripDropDownClosingEventArgs.cs
- RuleEngine.cs
- BitmapSizeOptions.cs
- Marshal.cs
- DataGridViewCheckBoxColumn.cs
- Privilege.cs
- objectquery_tresulttype.cs
- CorrelationToken.cs
- RtfControls.cs
- XmlAnyAttributeAttribute.cs
- AssociationEndMember.cs