Code:
/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / ClientServices / ClientFormsIdentity.cs / 1 / ClientFormsIdentity.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.ClientServices { using System; using System.Net; using System.Security.Principal; using System.Runtime.InteropServices; using System.Security; using System.Web.Security; using System.Diagnostics.CodeAnalysis; public class ClientFormsIdentity : IIdentity, IDisposable { public string Name { get { return _Name; }} public bool IsAuthenticated { get { return _IsAuthenticated; }} public string AuthenticationType { get { return _AuthenticationType; } } public CookieContainer AuthenticationCookies { get { return _AuthenticationCookies; } } public MembershipProvider Provider { get { return _Provider; } } public ClientFormsIdentity(string name, string password, MembershipProvider provider, string authenticationType, bool isAuthenticated, CookieContainer authenticationCookies) { _Name = name; _AuthenticationType = authenticationType; _IsAuthenticated = isAuthenticated; _AuthenticationCookies = authenticationCookies; _Password = GetSecureStringFromString(password); _Provider = provider; } public void RevalidateUser() { _Provider.ValidateUser(_Name, GetStringFromSecureString(_Password)); } public void Dispose() { _Password.Dispose(); } private string _Name; private bool _IsAuthenticated; private string _AuthenticationType; private CookieContainer _AuthenticationCookies; private SecureString _Password; private MembershipProvider _Provider; private static SecureString GetSecureStringFromString(string password) { char[] passwordChars = password.ToCharArray(); SecureString ss = new SecureString(); for (int iter = 0; iter < passwordChars.Length; iter++) ss.AppendChar(passwordChars[iter]); ss.MakeReadOnly(); return ss; } [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification="Reviewed and approved by feature crew")] private static string GetStringFromSecureString(SecureString securePass) { IntPtr bstr = IntPtr.Zero; try { bstr = Marshal.SecureStringToBSTR(securePass); return Marshal.PtrToStringBSTR(bstr); } finally { if (bstr != IntPtr.Zero) Marshal.FreeBSTR(bstr); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewDataErrorEventArgs.cs
- KeyInfo.cs
- LinqDataSourceStatusEventArgs.cs
- SpeechRecognitionEngine.cs
- StrokeNodeData.cs
- PointAnimationUsingPath.cs
- SqlDependencyListener.cs
- Underline.cs
- FormsAuthenticationTicket.cs
- RbTree.cs
- AssociationSet.cs
- ForEach.cs
- DirectionalLight.cs
- TextLineResult.cs
- FacetEnabledSchemaElement.cs
- DateBoldEvent.cs
- InputGestureCollection.cs
- RoleManagerEventArgs.cs
- XmlDigitalSignatureProcessor.cs
- SplitterPanel.cs
- DataSourceControlBuilder.cs
- DataGridColumnEventArgs.cs
- PointAnimationBase.cs
- ServiceChannelFactory.cs
- PropertyGridEditorPart.cs
- BamlVersionHeader.cs
- DataGridItemEventArgs.cs
- ObjectTokenCategory.cs
- LinqDataSourceView.cs
- TriState.cs
- RelatedCurrencyManager.cs
- ValueHandle.cs
- DataGridViewComponentPropertyGridSite.cs
- XmlObjectSerializerReadContext.cs
- NetDataContractSerializer.cs
- WebServicesDescriptionAttribute.cs
- UndoUnit.cs
- Hash.cs
- ValueCollectionParameterReader.cs
- SqlClientMetaDataCollectionNames.cs
- AccessKeyManager.cs
- MailSettingsSection.cs
- XmlQueryCardinality.cs
- manifestimages.cs
- PerfCounterSection.cs
- InvalidOleVariantTypeException.cs
- ContainerUtilities.cs
- WebEventCodes.cs
- BufferedStream.cs
- BuildManager.cs
- NamespaceMapping.cs
- Subset.cs
- ListParaClient.cs
- DataSourceIDConverter.cs
- DiscoveryService.cs
- IgnoreFileBuildProvider.cs
- WebResponse.cs
- SelectionRangeConverter.cs
- DbCommandDefinition.cs
- InstanceLockQueryResult.cs
- XmlSchemaSet.cs
- AbstractSvcMapFileLoader.cs
- PersonalizationState.cs
- TickBar.cs
- ClientCultureInfo.cs
- XomlDesignerLoader.cs
- ToolStripItemBehavior.cs
- RawTextInputReport.cs
- GlyphCache.cs
- FtpWebRequest.cs
- TemplateBindingExpressionConverter.cs
- SiblingIterators.cs
- ComplusTypeValidator.cs
- WindowsStatusBar.cs
- WebPartsSection.cs
- InfoCardAsymmetricCrypto.cs
- DependencyStoreSurrogate.cs
- Compiler.cs
- StringToken.cs
- SubtreeProcessor.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- Process.cs
- SafeHandle.cs
- ProtectedProviderSettings.cs
- Menu.cs
- StreamMarshaler.cs
- SelectionRangeConverter.cs
- SamlAudienceRestrictionCondition.cs
- Deflater.cs
- PathData.cs
- OdbcErrorCollection.cs
- WmpBitmapDecoder.cs
- GroupQuery.cs
- TextProperties.cs
- FlowDocumentPaginator.cs
- DataServiceException.cs
- ConfigurationSectionCollection.cs
- EditingScope.cs
- AppSettingsSection.cs
- ActivityUtilities.cs