Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Security / AuthenticationService.cs / 1305376 / 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
- PackagePartCollection.cs
- ContentElement.cs
- PersonalizationProviderHelper.cs
- FontFaceLayoutInfo.cs
- RecognizeCompletedEventArgs.cs
- InkCanvasInnerCanvas.cs
- UserControlCodeDomTreeGenerator.cs
- Transform3DCollection.cs
- WindowsFormsHelpers.cs
- ConnectionPoint.cs
- LocatorPartList.cs
- ErrorInfoXmlDocument.cs
- SqlCrossApplyToCrossJoin.cs
- UDPClient.cs
- WebControlParameterProxy.cs
- Int32CAMarshaler.cs
- ScriptComponentDescriptor.cs
- SmiConnection.cs
- Mappings.cs
- DetailsViewUpdatedEventArgs.cs
- EntityCommandDefinition.cs
- RepeaterItemEventArgs.cs
- PageAsyncTask.cs
- SqlMethodTransformer.cs
- SystemIPInterfaceStatistics.cs
- TimerElapsedEvenArgs.cs
- hebrewshape.cs
- TableLayout.cs
- ExceptionValidationRule.cs
- PrintDocument.cs
- NamedPipeConnectionPool.cs
- PreloadedPackages.cs
- ButtonRenderer.cs
- PolicyStatement.cs
- Border.cs
- TargetConverter.cs
- NamedPipeTransportSecurityElement.cs
- TextEditorTyping.cs
- DesignerDataColumn.cs
- SafePointer.cs
- ConfigUtil.cs
- DisplayToken.cs
- OdbcEnvironment.cs
- Math.cs
- CharEntityEncoderFallback.cs
- MediaCommands.cs
- HttpCapabilitiesBase.cs
- QueryCreatedEventArgs.cs
- FontNamesConverter.cs
- DependentTransaction.cs
- PackWebRequest.cs
- HandledMouseEvent.cs
- TypeHelpers.cs
- OleDbTransaction.cs
- HttpContext.cs
- PseudoWebRequest.cs
- LOSFormatter.cs
- NumberFormatter.cs
- TransactionalPackage.cs
- XmlSchemaCompilationSettings.cs
- ProxyHelper.cs
- ResetableIterator.cs
- EntitySet.cs
- MailAddressParser.cs
- CopyNamespacesAction.cs
- DBSqlParserColumnCollection.cs
- MobileUITypeEditor.cs
- CryptoProvider.cs
- StringArrayConverter.cs
- MetadataItemEmitter.cs
- DoWorkEventArgs.cs
- ResXResourceWriter.cs
- RegexCompilationInfo.cs
- InkCanvasSelectionAdorner.cs
- ExecutionScope.cs
- odbcmetadatacolumnnames.cs
- DesignColumnCollection.cs
- TypeResolver.cs
- HashStream.cs
- TableLayoutPanelCellPosition.cs
- ThemeableAttribute.cs
- safelink.cs
- DbConvert.cs
- _SSPIWrapper.cs
- dbenumerator.cs
- TypeElementCollection.cs
- AddInActivator.cs
- NameValueConfigurationCollection.cs
- ClientTarget.cs
- HandlerFactoryCache.cs
- PriorityBinding.cs
- ExpressionValueEditor.cs
- PixelShader.cs
- SchemaAttDef.cs
- EventInfo.cs
- XmlLinkedNode.cs
- SpellCheck.cs
- Point3DIndependentAnimationStorage.cs
- ConnectionStringsSection.cs
- ApplicationServiceHelper.cs