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
- BamlRecordWriter.cs
- SendKeys.cs
- HuffModule.cs
- DataTable.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- ColorConverter.cs
- TdsValueSetter.cs
- ApplicationManager.cs
- TypeDescriptor.cs
- httpstaticobjectscollection.cs
- HttpConfigurationContext.cs
- VisualBasicImportReference.cs
- InstanceStoreQueryResult.cs
- Literal.cs
- TypefaceMap.cs
- UIServiceHelper.cs
- CqlErrorHelper.cs
- BaseCodeDomTreeGenerator.cs
- Misc.cs
- PreservationFileReader.cs
- DoubleAnimationUsingKeyFrames.cs
- CodeSubDirectory.cs
- StyleModeStack.cs
- ConfigXmlCDataSection.cs
- PhysicalOps.cs
- MdiWindowListStrip.cs
- SpeechDetectedEventArgs.cs
- TraversalRequest.cs
- RectangleGeometry.cs
- FixedPage.cs
- ZipIOLocalFileDataDescriptor.cs
- ExpressionVisitor.cs
- OutputCacheProfileCollection.cs
- SourceSwitch.cs
- MemberNameValidator.cs
- IdleTimeoutMonitor.cs
- StorageComplexTypeMapping.cs
- XmlException.cs
- XmlBoundElement.cs
- FactoryGenerator.cs
- NameValueCache.cs
- Canvas.cs
- DiscriminatorMap.cs
- MexHttpsBindingElement.cs
- TypeSystem.cs
- PrintDialogException.cs
- BamlLocalizer.cs
- ContentFileHelper.cs
- KeyValueConfigurationCollection.cs
- DynamicField.cs
- WorkflowServiceBehavior.cs
- DoubleConverter.cs
- SpecialFolderEnumConverter.cs
- MetadataItemEmitter.cs
- SQLDoubleStorage.cs
- ObjectAssociationEndMapping.cs
- ObjectHelper.cs
- coordinator.cs
- TextRangeEditTables.cs
- DLinqAssociationProvider.cs
- ISFTagAndGuidCache.cs
- XamlRtfConverter.cs
- WindowsSysHeader.cs
- WebBrowserEvent.cs
- UserControlParser.cs
- ChameleonKey.cs
- MetricEntry.cs
- SimpleMailWebEventProvider.cs
- DataViewSetting.cs
- EventLogReader.cs
- CustomAttributeBuilder.cs
- CuspData.cs
- TreeWalker.cs
- JsonByteArrayDataContract.cs
- OledbConnectionStringbuilder.cs
- BaseCodeDomTreeGenerator.cs
- KeySplineConverter.cs
- RenderData.cs
- ControlEvent.cs
- SerializationSectionGroup.cs
- SocketAddress.cs
- DomNameTable.cs
- SqlUserDefinedAggregateAttribute.cs
- SignalGate.cs
- NominalTypeEliminator.cs
- TypeToken.cs
- ConnectionProviderAttribute.cs
- TransformPattern.cs
- TimeZone.cs
- ProcessHostFactoryHelper.cs
- HandleRef.cs
- SqlDataSource.cs
- TraceProvider.cs
- ConstraintConverter.cs
- WindowCollection.cs
- ProxyDataContractResolver.cs
- ProfessionalColors.cs
- X509ChainElement.cs
- DataBindingHandlerAttribute.cs
- HttpListenerPrefixCollection.cs