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
- WindowsListViewItem.cs
- TextTreeInsertUndoUnit.cs
- RadioButtonRenderer.cs
- SpecialNameAttribute.cs
- Psha1DerivedKeyGenerator.cs
- WorkflowElementDialogWindow.xaml.cs
- PropertyValue.cs
- DnsCache.cs
- log.cs
- EnumMember.cs
- DataColumnSelectionConverter.cs
- GPPOINTF.cs
- TextEncodedRawTextWriter.cs
- InstanceData.cs
- Logging.cs
- ExternalFile.cs
- NotFiniteNumberException.cs
- WindowsTooltip.cs
- SplineKeyFrames.cs
- RepeaterDataBoundAdapter.cs
- WebBrowser.cs
- InternalSafeNativeMethods.cs
- ToolStripLabel.cs
- RegexStringValidator.cs
- MSAAEventDispatcher.cs
- ForwardPositionQuery.cs
- TextClipboardData.cs
- CompiledRegexRunner.cs
- Bits.cs
- DrawingImage.cs
- ExtensibleClassFactory.cs
- MsmqHostedTransportManager.cs
- SecureConversationServiceCredential.cs
- InternalCompensate.cs
- VersionConverter.cs
- followingquery.cs
- CharAnimationUsingKeyFrames.cs
- WebPartConnectionsEventArgs.cs
- HostVisual.cs
- ArcSegment.cs
- ManagedFilter.cs
- ListViewSortEventArgs.cs
- PartialList.cs
- metadatamappinghashervisitor.cs
- ObsoleteAttribute.cs
- DrawingCollection.cs
- XsltContext.cs
- CompatibleIComparer.cs
- DataTemplateSelector.cs
- SafeSecurityHelper.cs
- SelfSignedCertificate.cs
- SmiEventStream.cs
- ValidationRuleCollection.cs
- TextWriter.cs
- TimeoutException.cs
- PersonalizationStateInfoCollection.cs
- TimeZone.cs
- XmlUtf8RawTextWriter.cs
- WindowsListViewScroll.cs
- CorruptingExceptionCommon.cs
- ContextMenu.cs
- WebPartDisplayModeCancelEventArgs.cs
- EditorResources.cs
- CodeArrayCreateExpression.cs
- SocketManager.cs
- CodeEventReferenceExpression.cs
- HttpModulesSection.cs
- PropertyDescriptorComparer.cs
- COM2PictureConverter.cs
- XmlSortKey.cs
- Behavior.cs
- RowVisual.cs
- StickyNoteHelper.cs
- JpegBitmapEncoder.cs
- HandlerBase.cs
- DetailsViewInsertedEventArgs.cs
- FixedMaxHeap.cs
- loginstatus.cs
- GatewayDefinition.cs
- SecureConversationVersion.cs
- VisualBrush.cs
- IndicCharClassifier.cs
- SqlFormatter.cs
- DataGridTablesFactory.cs
- UpdateProgress.cs
- SqlCacheDependency.cs
- InputReferenceExpression.cs
- SQLBytes.cs
- PageThemeCodeDomTreeGenerator.cs
- RouteData.cs
- CustomCategoryAttribute.cs
- DetailsViewPageEventArgs.cs
- FixedNode.cs
- _FtpControlStream.cs
- SrgsToken.cs
- HttpApplicationFactory.cs
- TextViewBase.cs
- Axis.cs
- LambdaCompiler.Address.cs
- ProfileGroupSettings.cs