Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ViewLoader.cs
- WebContext.cs
- MarkupCompiler.cs
- DataColumn.cs
- HScrollBar.cs
- GridLength.cs
- MenuItemStyle.cs
- DataGridColumnHeaderCollection.cs
- CodeMemberField.cs
- SiteMapNodeItem.cs
- AssemblySettingAttributes.cs
- XPathNavigatorKeyComparer.cs
- AnnotationHighlightLayer.cs
- SqlClientWrapperSmiStream.cs
- DPAPIProtectedConfigurationProvider.cs
- CodeConditionStatement.cs
- QilVisitor.cs
- InvokeWebServiceDesigner.cs
- TrackingRecord.cs
- ObjectTypeMapping.cs
- Validator.cs
- ProcessHostFactoryHelper.cs
- DeclaredTypeValidator.cs
- MsmqAppDomainProtocolHandler.cs
- MediaPlayer.cs
- TreeViewItemAutomationPeer.cs
- ServiceOperationParameter.cs
- TypeInitializationException.cs
- DataGridColumnHeaderAutomationPeer.cs
- DataShape.cs
- HyperLinkDataBindingHandler.cs
- SafeMILHandleMemoryPressure.cs
- Privilege.cs
- EdmConstants.cs
- ConfigurationLocation.cs
- TextBoxView.cs
- TextBoxBase.cs
- QueueAccessMode.cs
- Comparer.cs
- ModelItemKeyValuePair.cs
- IImplicitResourceProvider.cs
- SqlProcedureAttribute.cs
- SafeReadContext.cs
- TextEffectCollection.cs
- ButtonColumn.cs
- PropertyItem.cs
- InvariantComparer.cs
- ResourcesGenerator.cs
- ConfigurationStrings.cs
- NameTable.cs
- CompiledIdentityConstraint.cs
- EncodingTable.cs
- ProgressBarBrushConverter.cs
- CanonicalizationDriver.cs
- OdbcConnectionPoolProviderInfo.cs
- FixedTextPointer.cs
- SchemaObjectWriter.cs
- TextParagraphCache.cs
- RuleSetCollection.cs
- ConfigXmlWhitespace.cs
- SizeChangedInfo.cs
- HtmlShim.cs
- UriTemplateQueryValue.cs
- HtmlShim.cs
- EndpointIdentityExtension.cs
- Switch.cs
- RepeaterItemEventArgs.cs
- MultiSelectRootGridEntry.cs
- ChannelParameterCollection.cs
- XNameConverter.cs
- SQLMembershipProvider.cs
- TextStore.cs
- EnumerableCollectionView.cs
- CircleHotSpot.cs
- TextViewBase.cs
- DesignBindingEditor.cs
- ImageIndexEditor.cs
- EmptyControlCollection.cs
- ServiceHttpHandlerFactory.cs
- SystemKeyConverter.cs
- StateManagedCollection.cs
- LineGeometry.cs
- MouseGestureConverter.cs
- DataGridCommandEventArgs.cs
- PropertyInformation.cs
- PolicyException.cs
- TextElementCollection.cs
- Timer.cs
- figurelength.cs
- DataStorage.cs
- AppDomainEvidenceFactory.cs
- XPathItem.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- CryptoConfig.cs
- DataGridViewColumn.cs
- XmlStreamStore.cs
- DataViewSettingCollection.cs
- ProcessingInstructionAction.cs
- Socket.cs
- Message.cs