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
- TextOnlyOutput.cs
- SqlExpander.cs
- ICollection.cs
- DocumentViewerAutomationPeer.cs
- VariableAction.cs
- VideoDrawing.cs
- WebPartEditorApplyVerb.cs
- GridErrorDlg.cs
- ColorConvertedBitmap.cs
- DataPagerFieldCollection.cs
- WebScriptMetadataMessageEncoderFactory.cs
- HiddenFieldPageStatePersister.cs
- DataGridViewCellStyleConverter.cs
- ObjectQueryState.cs
- WorkItem.cs
- EntityDesignerBuildProvider.cs
- ThreadStartException.cs
- URLMembershipCondition.cs
- RemotingServices.cs
- _IPv4Address.cs
- SqlClientPermission.cs
- Tile.cs
- CodeThrowExceptionStatement.cs
- DateTimeSerializationSection.cs
- Send.cs
- HttpWebResponse.cs
- FixedSOMTableCell.cs
- RuleProcessor.cs
- Dispatcher.cs
- InternalConfigEventArgs.cs
- SqlClientFactory.cs
- ToggleButtonAutomationPeer.cs
- ContextDataSourceView.cs
- SystemIPAddressInformation.cs
- ResourceExpression.cs
- EntityClientCacheEntry.cs
- DataColumnChangeEvent.cs
- StateWorkerRequest.cs
- EncoderFallback.cs
- AppSettingsExpressionBuilder.cs
- InkCanvasAutomationPeer.cs
- BCryptSafeHandles.cs
- XNodeValidator.cs
- WebScriptServiceHost.cs
- DispatcherProcessingDisabled.cs
- DocumentPageView.cs
- CookielessHelper.cs
- arc.cs
- SqlRewriteScalarSubqueries.cs
- InputProcessorProfilesLoader.cs
- PersonalizationAdministration.cs
- BindingBase.cs
- Size.cs
- ITreeGenerator.cs
- SqlNode.cs
- ServicesUtilities.cs
- RegionInfo.cs
- ProfilePropertySettings.cs
- ElementNotAvailableException.cs
- BitmapPalettes.cs
- GetPageNumberCompletedEventArgs.cs
- PathFigure.cs
- XmlConvert.cs
- FileChangesMonitor.cs
- Matrix3DStack.cs
- SslStreamSecurityBindingElement.cs
- GradientStopCollection.cs
- ManageRequest.cs
- ToolStripButton.cs
- DoubleAnimation.cs
- localization.cs
- coordinatorscratchpad.cs
- InplaceBitmapMetadataWriter.cs
- TextParagraph.cs
- ParameterElementCollection.cs
- CaseStatement.cs
- MimeBasePart.cs
- NativeMethods.cs
- UrlAuthorizationModule.cs
- TimeoutValidationAttribute.cs
- COAUTHIDENTITY.cs
- XmlSchemaSimpleContentRestriction.cs
- NavigationPropertyEmitter.cs
- FieldDescriptor.cs
- HtmlMeta.cs
- Certificate.cs
- AssemblyNameProxy.cs
- HttpDictionary.cs
- ConfigXmlAttribute.cs
- DataRowComparer.cs
- MarshalDirectiveException.cs
- TypeTypeConverter.cs
- ResourceContainer.cs
- Blend.cs
- AppearanceEditorPart.cs
- Stack.cs
- XmlBoundElement.cs
- ConfigXmlCDataSection.cs
- MenuItem.cs
- ImpersonationContext.cs