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
- WebBaseEventKeyComparer.cs
- XamlSerializer.cs
- SweepDirectionValidation.cs
- StylusPlugInCollection.cs
- MaskInputRejectedEventArgs.cs
- EarlyBoundInfo.cs
- ValueConversionAttribute.cs
- wmiprovider.cs
- ToolStripDropDownClosingEventArgs.cs
- WebPartCloseVerb.cs
- FamilyTypeface.cs
- Publisher.cs
- Expr.cs
- HMACMD5.cs
- ScopelessEnumAttribute.cs
- ArgIterator.cs
- NumericExpr.cs
- WizardStepBase.cs
- ClientConvert.cs
- Attributes.cs
- ValueConversionAttribute.cs
- DetailsViewCommandEventArgs.cs
- ChannelSinkStacks.cs
- CleanUpVirtualizedItemEventArgs.cs
- LambdaCompiler.Generated.cs
- KeyboardDevice.cs
- TemplateBaseAction.cs
- AbsoluteQuery.cs
- OptimizedTemplateContentHelper.cs
- OracleEncoding.cs
- ArrayExtension.cs
- ExtendedPropertiesHandler.cs
- ListCollectionView.cs
- StylusDownEventArgs.cs
- Decorator.cs
- DBCommandBuilder.cs
- PowerModeChangedEventArgs.cs
- DbMetaDataCollectionNames.cs
- securitycriticaldataformultiplegetandset.cs
- SafeEventLogReadHandle.cs
- NotSupportedException.cs
- PermissionAttributes.cs
- NonClientArea.cs
- HScrollBar.cs
- Freezable.cs
- TypeLoadException.cs
- WebPartZoneBase.cs
- OSFeature.cs
- sitestring.cs
- Expressions.cs
- MessageDecoder.cs
- WebSysDescriptionAttribute.cs
- BindingSourceDesigner.cs
- ProjectionAnalyzer.cs
- BlockingCollection.cs
- thaishape.cs
- XPathNodeList.cs
- XmlDataContract.cs
- Function.cs
- SHA384CryptoServiceProvider.cs
- CatalogPart.cs
- RTTrackingProfile.cs
- EventSinkHelperWriter.cs
- TextureBrush.cs
- HttpHandlersSection.cs
- XmlSiteMapProvider.cs
- WSFederationHttpBindingCollectionElement.cs
- GetWinFXPath.cs
- ProfileGroupSettings.cs
- TableRowGroup.cs
- ListViewDataItem.cs
- TransactionsSectionGroup.cs
- PropertyRecord.cs
- RowParagraph.cs
- Events.cs
- CompilationSection.cs
- XmlComplianceUtil.cs
- GregorianCalendar.cs
- ModuleConfigurationInfo.cs
- Utility.cs
- ValueHandle.cs
- ServiceInstanceProvider.cs
- CheckBoxField.cs
- TraceRecord.cs
- TextMetrics.cs
- BamlRecordReader.cs
- FixedTextSelectionProcessor.cs
- ObjectManager.cs
- XmlKeywords.cs
- StorageRoot.cs
- OrderedDictionary.cs
- MemberInfoSerializationHolder.cs
- QilBinary.cs
- ProcessModuleCollection.cs
- CapabilitiesState.cs
- PropertyTabAttribute.cs
- DataStreamFromComStream.cs
- SaveFileDialog.cs
- StringUtil.cs
- CancelEventArgs.cs