Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- AddressAlreadyInUseException.cs
- securitymgrsite.cs
- KeyNameIdentifierClause.cs
- PropertyDescriptorGridEntry.cs
- ByteStorage.cs
- EffectiveValueEntry.cs
- SetStateDesigner.cs
- IisTraceWebEventProvider.cs
- BindingContext.cs
- RegexFCD.cs
- ElementAction.cs
- Single.cs
- ConstructorNeedsTagAttribute.cs
- Util.cs
- DataServices.cs
- PackagePartCollection.cs
- Dump.cs
- SettingsAttributeDictionary.cs
- Matrix3D.cs
- ExpressionWriter.cs
- SetterBase.cs
- ObjectDataSourceSelectingEventArgs.cs
- sqlser.cs
- RenderDataDrawingContext.cs
- WebService.cs
- XmlCDATASection.cs
- ImagingCache.cs
- Point3DValueSerializer.cs
- SrgsGrammar.cs
- AccessDataSource.cs
- MostlySingletonList.cs
- ServiceSecurityContext.cs
- SmiEventSink_DeferedProcessing.cs
- AstNode.cs
- WindowsScroll.cs
- FamilyTypefaceCollection.cs
- FileIOPermission.cs
- FolderNameEditor.cs
- WindowsAuthenticationModule.cs
- FileDialogCustomPlace.cs
- HatchBrush.cs
- StringExpressionSet.cs
- AspCompat.cs
- CfgArc.cs
- AxisAngleRotation3D.cs
- CodeArrayIndexerExpression.cs
- BrowserCapabilitiesCompiler.cs
- TextBox.cs
- PerformanceCounterPermissionEntry.cs
- WebPartConnectionsCancelEventArgs.cs
- AsyncWaitHandle.cs
- SQLDoubleStorage.cs
- SHA256.cs
- CorrelationToken.cs
- _ListenerAsyncResult.cs
- BitmapCacheBrush.cs
- QilChoice.cs
- ACL.cs
- Root.cs
- SystemException.cs
- PriorityRange.cs
- XmlILOptimizerVisitor.cs
- TextDecorations.cs
- DictionarySectionHandler.cs
- SmtpAuthenticationManager.cs
- SmiContextFactory.cs
- QuaternionAnimationBase.cs
- UrlAuthFailedErrorFormatter.cs
- SymLanguageType.cs
- WebPartHeaderCloseVerb.cs
- EventLogPropertySelector.cs
- HighlightVisual.cs
- EventDescriptorCollection.cs
- Compiler.cs
- TreeNodeBindingCollection.cs
- FixedSOMSemanticBox.cs
- SubMenuStyle.cs
- EdmRelationshipRoleAttribute.cs
- NativeMethods.cs
- PointAnimationClockResource.cs
- ParsedAttributeCollection.cs
- AddInIpcChannel.cs
- UriScheme.cs
- DbFunctionCommandTree.cs
- TimeoutConverter.cs
- StatusBarItemAutomationPeer.cs
- FontInfo.cs
- ConvertEvent.cs
- WorkflowServiceHostFactory.cs
- AssemblyName.cs
- ExceptionTrace.cs
- PerformanceCounterLib.cs
- FileDialogCustomPlace.cs
- HttpsChannelFactory.cs
- CodeArrayCreateExpression.cs
- HtmlAnchor.cs
- BackgroundWorker.cs
- AssemblyFilter.cs
- System.Data_BID.cs
- CanonicalFontFamilyReference.cs