Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DoubleAnimation.cs
- MetadataCache.cs
- PeerName.cs
- AttachInfo.cs
- initElementDictionary.cs
- LongAverageAggregationOperator.cs
- GenericQueueSurrogate.cs
- Message.cs
- DbMetaDataFactory.cs
- DiscreteKeyFrames.cs
- HwndProxyElementProvider.cs
- XmlEnumAttribute.cs
- VirtualPath.cs
- EventMappingSettingsCollection.cs
- DetailsViewActionList.cs
- SafeMILHandle.cs
- EnvelopedSignatureTransform.cs
- DeferrableContent.cs
- DispatcherEventArgs.cs
- CharacterString.cs
- DataBinder.cs
- LexicalChunk.cs
- UrlMappingCollection.cs
- TriggerActionCollection.cs
- SiteOfOriginPart.cs
- SystemIPGlobalProperties.cs
- SchemaComplexType.cs
- FormViewInsertEventArgs.cs
- XmlDataLoader.cs
- SmtpTransport.cs
- DataGridTableCollection.cs
- CorrelationKey.cs
- EncodingTable.cs
- DataDocumentXPathNavigator.cs
- WaitForChangedResult.cs
- RegexCaptureCollection.cs
- RecommendedAsConfigurableAttribute.cs
- Parser.cs
- IdleTimeoutMonitor.cs
- NativeMethods.cs
- TypeElementCollection.cs
- _TimerThread.cs
- MasterPage.cs
- MemoryRecordBuffer.cs
- Serializer.cs
- MetadataPropertyvalue.cs
- UntypedNullExpression.cs
- Int16Converter.cs
- Crypto.cs
- ScrollData.cs
- ipaddressinformationcollection.cs
- GridEntryCollection.cs
- InkCollectionBehavior.cs
- SmiXetterAccessMap.cs
- StorageRoot.cs
- AssemblyNameUtility.cs
- ToolStripPanelRow.cs
- RowsCopiedEventArgs.cs
- MatchAttribute.cs
- RuntimeWrappedException.cs
- IntSecurity.cs
- File.cs
- Simplifier.cs
- MdiWindowListStrip.cs
- ColorMap.cs
- SplineKeyFrames.cs
- DebugController.cs
- SamlDelegatingWriter.cs
- HideDisabledControlAdapter.cs
- Semaphore.cs
- DBSchemaRow.cs
- remotingproxy.cs
- PageParser.cs
- ResourceDefaultValueAttribute.cs
- ComboBox.cs
- WebPartTransformer.cs
- DesignerAutoFormat.cs
- TextSelectionHighlightLayer.cs
- FixedHyperLink.cs
- SqlFileStream.cs
- XmlNamespaceMappingCollection.cs
- StringInfo.cs
- CommittableTransaction.cs
- DBBindings.cs
- RootBuilder.cs
- ConfigurationValidatorBase.cs
- FixedDocumentSequencePaginator.cs
- DragSelectionMessageFilter.cs
- XmlDocumentFragment.cs
- AuthenticationConfig.cs
- BufferModesCollection.cs
- SortQuery.cs
- AsmxEndpointPickerExtension.cs
- SymLanguageType.cs
- Message.cs
- MappingItemCollection.cs
- FigureParagraph.cs
- COSERVERINFO.cs
- ImageMapEventArgs.cs
- AsyncPostBackErrorEventArgs.cs