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
- RowsCopiedEventArgs.cs
- EntityStoreSchemaFilterEntry.cs
- ArrayList.cs
- JsonWriterDelegator.cs
- MouseCaptureWithinProperty.cs
- ScrollBarRenderer.cs
- MLangCodePageEncoding.cs
- TreeNodeStyleCollection.cs
- XPathDocumentNavigator.cs
- TdsParameterSetter.cs
- SettingsProperty.cs
- RtfNavigator.cs
- AnimationException.cs
- ItemsPresenter.cs
- Emitter.cs
- XmlTextReaderImplHelpers.cs
- ServiceRoute.cs
- WebPartMinimizeVerb.cs
- SHA1Managed.cs
- precedingsibling.cs
- StrongTypingException.cs
- PaperSize.cs
- RegistryDataKey.cs
- SqlCharStream.cs
- MenuBase.cs
- peernodeimplementation.cs
- ContextInformation.cs
- SafeEventHandle.cs
- ObjectHelper.cs
- InkSerializer.cs
- HttpRequest.cs
- GridView.cs
- OrderedEnumerableRowCollection.cs
- ApplicationServiceHelper.cs
- HtmlLink.cs
- ServiceBusyException.cs
- filewebrequest.cs
- PathStreamGeometryContext.cs
- TiffBitmapEncoder.cs
- URLAttribute.cs
- WorkflowLayouts.cs
- StringResourceManager.cs
- DetailsViewRowCollection.cs
- VisualBasicHelper.cs
- TreeNodeStyle.cs
- OperationParameterInfo.cs
- ClientTarget.cs
- Parallel.cs
- ASCIIEncoding.cs
- AssemblyBuilder.cs
- PreviewKeyDownEventArgs.cs
- ListViewItemSelectionChangedEvent.cs
- WeakReadOnlyCollection.cs
- FileCodeGroup.cs
- DefaultTextStore.cs
- CookielessHelper.cs
- ConfigXmlComment.cs
- StringReader.cs
- ElementHostPropertyMap.cs
- PreloadedPackages.cs
- WorkflowRuntimeSection.cs
- ValidatorCompatibilityHelper.cs
- UrlMapping.cs
- ValidationPropertyAttribute.cs
- BinaryObjectInfo.cs
- Vector3DCollectionConverter.cs
- AttributeXamlType.cs
- CharStorage.cs
- SafeNativeMethodsMilCoreApi.cs
- Cell.cs
- SqlCaseSimplifier.cs
- SimpleType.cs
- XmlDataDocument.cs
- DefaultAssemblyResolver.cs
- TransformPattern.cs
- URLBuilder.cs
- HttpWebRequest.cs
- ToolBarDesigner.cs
- StructureChangedEventArgs.cs
- VersionedStream.cs
- HttpStreamMessageEncoderFactory.cs
- ArgumentValueSerializer.cs
- X509RawDataKeyIdentifierClause.cs
- Brush.cs
- BamlRecordReader.cs
- InputLanguageProfileNotifySink.cs
- BitmapEffectDrawing.cs
- ProxyHelper.cs
- TraceHandler.cs
- WebHttpSecurity.cs
- FileSystemEventArgs.cs
- ListItemCollection.cs
- SamlEvidence.cs
- SkipQueryOptionExpression.cs
- ColumnBinding.cs
- GZipStream.cs
- InheritanceContextHelper.cs
- BooleanSwitch.cs
- DataTable.cs
- XpsS0ValidatingLoader.cs