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
- FixedBufferAttribute.cs
- BufferedStream.cs
- HtmlShimManager.cs
- KnownBoxes.cs
- EncoderNLS.cs
- SnapshotChangeTrackingStrategy.cs
- SqlClientPermission.cs
- PeerNeighborManager.cs
- OperationAbortedException.cs
- _TLSstream.cs
- XPathExpr.cs
- CriticalHandle.cs
- SlipBehavior.cs
- ToolStripDesignerUtils.cs
- RegexCompilationInfo.cs
- OracleLob.cs
- ObjectStateEntryDbDataRecord.cs
- ResXBuildProvider.cs
- UpdateCompiler.cs
- VersionConverter.cs
- AlphabeticalEnumConverter.cs
- DiffuseMaterial.cs
- DragDrop.cs
- LocalServiceSecuritySettingsElement.cs
- ScriptReferenceEventArgs.cs
- DefaultTraceListener.cs
- SqlProfileProvider.cs
- Int32CAMarshaler.cs
- XpsFilter.cs
- ListItemCollection.cs
- ZipIOBlockManager.cs
- RoleBoolean.cs
- NamespaceList.cs
- EndGetFileNameFromUserRequest.cs
- ConnectAlgorithms.cs
- BitmapEncoder.cs
- RoleExceptions.cs
- WeakEventTable.cs
- BitmapMetadataBlob.cs
- DiagnosticTraceSchemas.cs
- RawStylusInput.cs
- FastEncoder.cs
- RenamedEventArgs.cs
- Odbc32.cs
- PopupEventArgs.cs
- SymLanguageVendor.cs
- MbpInfo.cs
- WriteTimeStream.cs
- SafeMemoryMappedViewHandle.cs
- Addressing.cs
- WebHeaderCollection.cs
- Directory.cs
- EdmValidator.cs
- QuinticEase.cs
- SectionVisual.cs
- StorageMappingItemCollection.cs
- TransactionScopeDesigner.cs
- Constants.cs
- NullableFloatSumAggregationOperator.cs
- AnimationLayer.cs
- CodeLinePragma.cs
- SynchronizedInputHelper.cs
- AppDomainFactory.cs
- CroppedBitmap.cs
- _BufferOffsetSize.cs
- EntityUtil.cs
- CrossSiteScriptingValidation.cs
- LineServicesRun.cs
- SimpleType.cs
- ViewBase.cs
- WmpBitmapEncoder.cs
- ScriptMethodAttribute.cs
- Decorator.cs
- RectAnimationUsingKeyFrames.cs
- ApplicationBuildProvider.cs
- DateTimeUtil.cs
- StubHelpers.cs
- FileUtil.cs
- ConsoleEntryPoint.cs
- SimpleMailWebEventProvider.cs
- DataRelationCollection.cs
- ManipulationDeltaEventArgs.cs
- InputProcessorProfiles.cs
- Vector3DAnimationUsingKeyFrames.cs
- IteratorFilter.cs
- ContentElementAutomationPeer.cs
- PolyLineSegment.cs
- SafeHandles.cs
- XmlSignatureManifest.cs
- XmlSchemaComplexContentRestriction.cs
- LockCookie.cs
- BindingMAnagerBase.cs
- HttpHandlerAction.cs
- ClientBuildManagerCallback.cs
- PropertyInfoSet.cs
- ColumnReorderedEventArgs.cs
- XmlQueryStaticData.cs
- PlaceHolder.cs
- WsdlBuildProvider.cs
- MouseGestureConverter.cs