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
- SupportsEventValidationAttribute.cs
- BindingsCollection.cs
- WeakReferenceEnumerator.cs
- TextTreeUndoUnit.cs
- ArgumentNullException.cs
- COM2Properties.cs
- TextTreeText.cs
- HttpServerProtocol.cs
- PowerModeChangedEventArgs.cs
- EdmFunction.cs
- CharacterMetrics.cs
- Command.cs
- AddInServer.cs
- ShaperBuffers.cs
- BaseCodePageEncoding.cs
- Maps.cs
- formatstringdialog.cs
- SharedDp.cs
- WizardStepBase.cs
- LingerOption.cs
- XmlSchemaSimpleType.cs
- TcpConnectionPoolSettings.cs
- DataGridTextBox.cs
- String.cs
- QueryInterceptorAttribute.cs
- TableLayoutPanel.cs
- SqlUnionizer.cs
- EventBookmark.cs
- X509ChainElement.cs
- PageAdapter.cs
- Expressions.cs
- CheckBoxStandardAdapter.cs
- InlineCollection.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- DiagnosticSection.cs
- DesignerTransactionCloseEvent.cs
- ServiceBusyException.cs
- XmlNodeReader.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- FontCollection.cs
- HybridDictionary.cs
- odbcmetadatacollectionnames.cs
- ZipIOExtraField.cs
- PrintingPermission.cs
- CallbackBehaviorAttribute.cs
- TransactionTable.cs
- ReflectionTypeLoadException.cs
- FontFamily.cs
- ServicesSection.cs
- DBConnectionString.cs
- UpdateTracker.cs
- FontSourceCollection.cs
- SymbolEqualComparer.cs
- ThemeableAttribute.cs
- _NestedSingleAsyncResult.cs
- TableLayoutCellPaintEventArgs.cs
- ManipulationLogic.cs
- SplashScreen.cs
- PointConverter.cs
- AutomationPattern.cs
- FixedDocument.cs
- TypeConverters.cs
- M3DUtil.cs
- DataGridLinkButton.cs
- StructuralObject.cs
- CorrelationToken.cs
- Propagator.Evaluator.cs
- Interlocked.cs
- SqlBuilder.cs
- Vector3dCollection.cs
- CommandValueSerializer.cs
- BuildProvidersCompiler.cs
- ZipIOBlockManager.cs
- BamlWriter.cs
- LocalizationParserHooks.cs
- QuotedPrintableStream.cs
- StopStoryboard.cs
- Track.cs
- State.cs
- NoPersistScope.cs
- CloudCollection.cs
- SoapFormatter.cs
- AsyncResult.cs
- AddressAlreadyInUseException.cs
- PageStatePersister.cs
- GuidelineSet.cs
- RegexReplacement.cs
- RepeatInfo.cs
- RuleInfoComparer.cs
- StringCollection.cs
- DrawingServices.cs
- WebPartDisplayMode.cs
- StdValidatorsAndConverters.cs
- DetailsViewInsertEventArgs.cs
- TableRowCollection.cs
- _TransmitFileOverlappedAsyncResult.cs
- ClipboardData.cs
- ToolboxItem.cs
- PassportAuthenticationEventArgs.cs
- XmlBoundElement.cs