Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- CheckBoxPopupAdapter.cs
- XmlValidatingReaderImpl.cs
- DataGridViewLinkColumn.cs
- Timeline.cs
- CellParagraph.cs
- ValidationRule.cs
- Command.cs
- BrowserCapabilitiesFactory35.cs
- BmpBitmapDecoder.cs
- ToolStripDesignerUtils.cs
- RepeaterItemCollection.cs
- DateTimeConstantAttribute.cs
- iisPickupDirectory.cs
- invalidudtexception.cs
- BaseAsyncResult.cs
- DES.cs
- ScrollPattern.cs
- XmlObjectSerializerReadContextComplexJson.cs
- FlowDocument.cs
- DataGridItemCollection.cs
- DataGridViewIntLinkedList.cs
- DoubleKeyFrameCollection.cs
- XmlLoader.cs
- XhtmlMobileTextWriter.cs
- ResourceBinder.cs
- X509Certificate.cs
- PeerContact.cs
- NamespaceMapping.cs
- RegexMatch.cs
- SQLSingleStorage.cs
- X509RecipientCertificateServiceElement.cs
- _UriSyntax.cs
- TypeSystemHelpers.cs
- ObjectParameter.cs
- KeyConstraint.cs
- DateTimeFormatInfoScanner.cs
- EntityDataSourceColumn.cs
- XmlILModule.cs
- RectValueSerializer.cs
- DispatcherObject.cs
- Site.cs
- Quaternion.cs
- TemplateNameScope.cs
- PermissionSet.cs
- WaitForChangedResult.cs
- JsonWriter.cs
- GPRECT.cs
- MetabaseSettingsIis7.cs
- UnsafeNativeMethods.cs
- Int32Rect.cs
- ReachPrintTicketSerializerAsync.cs
- PolicyUnit.cs
- WinEventTracker.cs
- OdbcFactory.cs
- Marshal.cs
- XmlCharCheckingWriter.cs
- ProviderUtil.cs
- RTLAwareMessageBox.cs
- BooleanStorage.cs
- SHA384.cs
- relpropertyhelper.cs
- XmlDataFileEditor.cs
- Transform3DCollection.cs
- ClientRolePrincipal.cs
- CodeLabeledStatement.cs
- ValidationResult.cs
- CommandField.cs
- ActivityExecutionContextCollection.cs
- XmlRootAttribute.cs
- EncoderParameters.cs
- AuthenticationManager.cs
- ListMarkerLine.cs
- MobileRedirect.cs
- ChannelToken.cs
- DbParameterHelper.cs
- ArraySortHelper.cs
- DesignObjectWrapper.cs
- Int32.cs
- BaseCodePageEncoding.cs
- UnauthorizedWebPart.cs
- ComboBox.cs
- MSHTMLHost.cs
- ControlType.cs
- CompilationUtil.cs
- CSharpCodeProvider.cs
- XmlSchemaObjectCollection.cs
- EntityCommandDefinition.cs
- EntityRecordInfo.cs
- DependencyPropertyHelper.cs
- DoubleAnimation.cs
- InsufficientMemoryException.cs
- indexingfiltermarshaler.cs
- PageBreakRecord.cs
- SmiEventSink_DeferedProcessing.cs
- RemotingService.cs
- Condition.cs
- VirtualPath.cs
- WeakReference.cs
- Environment.cs
- Activity.cs