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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XPathMultyIterator.cs
- EpmContentSerializer.cs
- EditorResources.cs
- SettingsSavedEventArgs.cs
- WsrmTraceRecord.cs
- StyleModeStack.cs
- Condition.cs
- Cursor.cs
- RegexReplacement.cs
- FilterEventArgs.cs
- Blend.cs
- NameSpaceEvent.cs
- PackagePartCollection.cs
- GotoExpression.cs
- NetDataContractSerializer.cs
- ClientFormsAuthenticationCredentials.cs
- OnOperation.cs
- DataListItemCollection.cs
- OptimizedTemplateContentHelper.cs
- StylusPointDescription.cs
- Cursor.cs
- TextPointer.cs
- ProfilePropertyNameValidator.cs
- PageRequestManager.cs
- GenericTypeParameterBuilder.cs
- XPathNavigator.cs
- ApplicationSecurityManager.cs
- RegexCharClass.cs
- PeerNearMe.cs
- DataBindingHandlerAttribute.cs
- NetStream.cs
- CompiledELinqQueryState.cs
- DuplexChannelBinder.cs
- DataControlPagerLinkButton.cs
- ContentElement.cs
- PersonalizationStateInfo.cs
- Library.cs
- XsltLoader.cs
- GenericRootAutomationPeer.cs
- BrowserCapabilitiesFactoryBase.cs
- LayoutSettings.cs
- TypeBuilderInstantiation.cs
- GridViewDeletedEventArgs.cs
- ElementAction.cs
- PathGeometry.cs
- SafePointer.cs
- HyperLink.cs
- PerspectiveCamera.cs
- XPathMultyIterator.cs
- Delegate.cs
- storepermission.cs
- EncryptedPackage.cs
- XmlSerializerAssemblyAttribute.cs
- PolyBezierSegment.cs
- SerializationAttributes.cs
- MouseOverProperty.cs
- RegexMatch.cs
- InfiniteTimeSpanConverter.cs
- ManifestSignatureInformation.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- LocalizationComments.cs
- SmiEventSink_DeferedProcessing.cs
- DesignBindingValueUIHandler.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- EndpointDispatcherTable.cs
- TraceContextEventArgs.cs
- OracleDataReader.cs
- Merger.cs
- Renderer.cs
- CodeMethodReturnStatement.cs
- XhtmlBasicLiteralTextAdapter.cs
- VersionPair.cs
- BoolLiteral.cs
- OdbcCommand.cs
- XmlChildNodes.cs
- AutomationPatternInfo.cs
- HttpDebugHandler.cs
- FixedDocumentPaginator.cs
- XsltArgumentList.cs
- ToolBar.cs
- TrackingAnnotationCollection.cs
- EntityViewGenerator.cs
- Stylesheet.cs
- RowUpdatingEventArgs.cs
- ArraySubsetEnumerator.cs
- SchemaContext.cs
- FixedSOMSemanticBox.cs
- StatusBarItem.cs
- BuildManagerHost.cs
- AffineTransform3D.cs
- CommandDevice.cs
- OleDbError.cs
- KeyGestureValueSerializer.cs
- GridViewColumnHeaderAutomationPeer.cs
- CodeDomLoader.cs
- WorkflowNamespace.cs
- CreateUserErrorEventArgs.cs
- ContentElement.cs
- BinaryMessageFormatter.cs
- SystemDropShadowChrome.cs