diff --git a/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp
deleted file mode 100644
index 99ec465e315..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//Types:System.Security.Permissions.IsolatedStorageContainment (enum)
-//Types:System.Security.Permissions.IsolatedStoragePermissionAttribute
-//Types:System.Security.Permissions.SecurityAction
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::IO::IsolatedStorage;
-using namespace System::IO;
-
-
-static void WriteIsolatedStorage()
-{
- try
- {
- // Attempt to create a storage file that is isolated by
- // user and assembly. IsolatedStorageFilePermission
- // granted to the attribute at the top of this file
- // allows CLR to load this assembly and execution of this
- // statement.
- Stream^ fileCreateStream = gcnew
- IsolatedStorageFileStream(
- "AssemblyData",
- FileMode::Create,
- IsolatedStorageFile::GetUserStoreForAssembly());
-
- StreamWriter^ streamWriter = gcnew StreamWriter(
- fileCreateStream);
- try
- {
- // Write some data out to the isolated file.
-
- streamWriter->Write("This is some test data.");
- streamWriter->Close();
- }
- finally
- {
- delete fileCreateStream;
- delete streamWriter;
- }
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-
- try
- {
- Stream^ fileOpenStream =
- gcnew IsolatedStorageFileStream(
- "AssemblyData",
- FileMode::Open,
- IsolatedStorageFile::GetUserStoreForAssembly());
- // Attempt to open the file that was previously created.
-
- StreamReader^ streamReader = gcnew StreamReader(
- fileOpenStream);
- try
- {
- // Read the data from the file and display it.
-
- Console::WriteLine(streamReader->ReadLine());
- streamReader->Close();
- }
- finally
- {
- delete fileOpenStream;
- delete streamReader;
- }
- }
- catch (FileNotFoundException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
- catch (IOException^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
-// Notify the CLR to only grant IsolatedStorageFilePermission to called methods.
-// This restricts the called methods to working only with storage files that are isolated
-// by user and assembly.
-[IsolatedStorageFilePermission(SecurityAction::PermitOnly, UsageAllowed = IsolatedStorageContainment::AssemblyIsolationByUser)]
-int main()
-{
- WriteIsolatedStorage();
-}
-
-// This code produces the following output.
-//
-// This is some test data.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp b/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp
deleted file mode 100644
index e61059912b5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-// Types:System.Security.IPermission Vendor:Richter
-// Types:System.Security.ISecurityEncodable Vendor:Richter
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Reflection;
-
-// Enumerated type for permission states.
-[Serializable]
-public enum class SoundPermissionState
-{
- NoSound = 0,
- PlaySystemSounds = 1,
- PlayAnySound = 2
-};
-
-// Derive from CodeAccessPermission to gain implementations of the following
-// sealed IStackWalk methods: Assert, Demand, Deny, and PermitOnly.
-// Implement the following abstract IPermission methods:
-// Copy, Intersect, and IsSubSetOf.
-// Implementing the Union method of the IPermission class is optional.
-// Implement the following abstract ISecurityEncodable methods:
-// FromXml and ToXml.
-// Making the class 'sealed' is optional.
-
-public ref class SoundPermission sealed : public CodeAccessPermission,
- public IPermission, public IUnrestrictedPermission,
- public ISecurityEncodable, public ICloneable
-{
-private:
- bool specifiedAsUnrestricted;
-private:
- SoundPermissionState stateFlags;
-
- // This constructor creates and initializes
- // a permission with generic access.
-public:
- SoundPermission(PermissionState^ state)
- {
- specifiedAsUnrestricted = (state == PermissionState::Unrestricted);
- }
-
- // This constructor creates and initializes
- // a permission with specific access.
-public:
- SoundPermission(SoundPermissionState flags)
- {
- if (flags < SoundPermissionState::NoSound ||
- flags > SoundPermissionState::PlayAnySound)
- {
- throw gcnew ArgumentException("The value of \"flags\" is not" +
- " valid for the SoundPermissionState enumerated type");
- }
- stateFlags = flags;
- }
-
- // For debugging, return the state of this object as XML.
-public:
- virtual String^ ToString() override
- {
- return ToXml()->ToString();
- }
-
- // Private method to cast (if possible) an IPermission to the type.
-private:
- SoundPermission^ VerifyTypeMatch(IPermission^ target)
- {
- if (GetType() != target->GetType())
- {
- throw gcnew ArgumentException(String::Format(
- "The variable \"target\" must be of the {0} type",
- GetType()->FullName));
- }
- return (SoundPermission^) target;
- }
-
- // This is the Private Clone helper method.
-private:
- SoundPermission^ Clone(bool specifiedAsUnrestricted,
- SoundPermissionState flags)
- {
- SoundPermission^ soundPerm = (SoundPermission^) Clone();
- soundPerm->specifiedAsUnrestricted = specifiedAsUnrestricted;
- soundPerm->stateFlags = specifiedAsUnrestricted ?
- SoundPermissionState::PlayAnySound : flags;
- return soundPerm;
- }
-
- #pragma region IPermission^ Members
- //
- // Return a new object that contains the intersection
- // of 'this' and 'target'.
-public:
- virtual IPermission^ Intersect(IPermission^ target) override
- {
- // If 'target' is null, return null.
- if (target == nullptr)
- {
- return nullptr;
- }
-
- // Both objects must be the same type.
- SoundPermission^ soundPerm = VerifyTypeMatch(target);
-
- // If 'this' and 'target' are unrestricted,
- // return a new unrestricted permission.
- if (specifiedAsUnrestricted && soundPerm->specifiedAsUnrestricted)
- {
- return Clone(true, SoundPermissionState::PlayAnySound);
- }
-
- // Calculate the intersected permissions.
- // If there are none, return null.
- SoundPermissionState minimumPermission = (SoundPermissionState)
- Math::Min((int) stateFlags, (int) soundPerm->stateFlags);
- if ((int)minimumPermission == 0)
- {
- return nullptr;
- }
-
- // Return a new object with the intersected permission value.
- return Clone(false, minimumPermission);
- }
- //
-
- //
- // Called by the Demand method: returns true
- // if 'this' is a subset of 'target'.
-public:
- virtual bool IsSubsetOf(IPermission^ target) override
- {
- // If 'target' is null and this permission allows nothing,
- // return true.
- if (target == nullptr)
- {
- return (int)stateFlags == 0;
- }
-
- // Both objects must be the same type.
- SoundPermission^ soundPerm = VerifyTypeMatch(target);
-
- // Return true if the permissions of 'this'
- // is a subset of 'target'.
- return stateFlags <= soundPerm->stateFlags;
- }
- //
-
- //
- // Return a new object that matches 'this' object's permissions.
-public:
- virtual IPermission^ Copy () override sealed
- {
- return (IPermission^) Clone();
- }
- //
-
- //
- // Return a new object that contains the union of 'this' and 'target'.
- // Note: You do not have to implement this method.
- // If you do not, the version
- // in CodeAccessPermission does this:
- // 1. If target is not null, a NotSupportedException is thrown.
- // 2. If target is null, then Copy is called and
- // the new object is returned.
-public:
- virtual IPermission^ Union(IPermission^ target) override
- {
- // If 'target' is null, then return a copy of 'this'.
- if (target == nullptr)
- {
- return Copy();
- }
-
- // Both objects must be the same type.
- SoundPermission^ soundPerm = VerifyTypeMatch(target);
-
- // If 'this' or 'target' are unrestricted,
- // return a new unrestricted permission.
- if (specifiedAsUnrestricted || soundPerm->specifiedAsUnrestricted)
- {
- return Clone(true, SoundPermissionState::PlayAnySound);
- }
-
- // Return a new object with the calculated, unioned permission value.
- return Clone(false, (SoundPermissionState)
- Math::Max((int) stateFlags, (int) soundPerm->stateFlags));
- }
- //
- #pragma endregion
-
- #pragma region ISecurityEncodable^ Members
- //
- // Populate the permission's fields from XML.
-public:
- virtual void FromXml(SecurityElement^ element) override
- {
- specifiedAsUnrestricted = false;
- stateFlags = (SoundPermissionState)0;
-
- // If XML indicates an unrestricted permission,
- // make this permission unrestricted.
- String^ attributeString =
- (String^) element->Attributes["Unrestricted"];
- if (attributeString != nullptr)
- {
- specifiedAsUnrestricted = Convert::ToBoolean(attributeString);
- if (specifiedAsUnrestricted)
- {
- stateFlags = SoundPermissionState::PlayAnySound;
- }
- }
-
- // If XML indicates a restricted permission, parse the flags.
- if (!specifiedAsUnrestricted)
- {
- attributeString = (String^) element->Attributes["Flags"];
- if (attributeString != nullptr)
- {
- stateFlags = (SoundPermissionState) Convert::ToInt32(
- Enum::Parse(SoundPermissionState::typeid,
- attributeString, true));
- }
- }
- }
- //
-
- //
- // Produce XML from the permission's fields.
-public:
- virtual SecurityElement^ ToXml() override
- {
- // These first three lines create an element with the required format.
- SecurityElement^ element = gcnew SecurityElement("IPermission");
- // Replace the double quotation marks ()
- // with single quotation marks ()
- // to remain XML compliant when the culture is not neutral.
- element->AddAttribute("class",
- GetType()->AssemblyQualifiedName->Replace('\"', '\''));
- element->AddAttribute("version", "1");
-
- if (!specifiedAsUnrestricted)
- {
- element->AddAttribute("Flags",
- Enum::Format(SoundPermissionState::typeid, stateFlags, "G"));
- }
- else
- {
- element->AddAttribute("Unrestricted", "true");
- }
- return element;
- }
- //
- #pragma endregion
-
- #pragma region IUnrestrictedPermission^ Members
- //
- // Returns true if permission is effectively unrestricted.
-public:
- virtual bool IsUnrestricted()
- {
- // This means that the object is unrestricted at runtime.
- return stateFlags == SoundPermissionState::PlayAnySound;
- }
- //
- #pragma endregion
-
- #pragma region ICloneable^ Members
-
- // Return a copy of the permission.
-public:
- virtual Object^ Clone()
- {
- return MemberwiseClone();
- }
-
- #pragma endregion
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp b/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp
deleted file mode 100644
index a3567246321..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Security::Permissions;
-using namespace System::Collections;
-
-[Flags]
-
-public enum class MailslotPermissionAccess
-{
- None = 0,
- Send = 1 << 1,
- Receive = 1 << 2 | MailslotPermissionAccess::Send
-};
-
-
-[Serializable]
-public ref class MailslotPermissionEntry
-{
-private:
- String^ name;
- String^ machineName;
- MailslotPermissionAccess permissionAccess;
-
-internal:
- MailslotPermissionEntry( ResourcePermissionBaseEntry^ baseEntry )
- {
- this->permissionAccess = (MailslotPermissionAccess)baseEntry->PermissionAccess;
- this->name = baseEntry->PermissionAccessPath[ 0 ]->ToString();
- this->machineName = baseEntry->PermissionAccessPath[ 1 ]->ToString();
- }
-
- ResourcePermissionBaseEntry^ GetBaseEntry()
- {
- array^newStrings = {this->Name,this->MachineName};
- ResourcePermissionBaseEntry^ baseEntry = gcnew ResourcePermissionBaseEntry( (int)(this->PermissionAccess),newStrings );
- return baseEntry;
- }
-
-public:
- MailslotPermissionEntry( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName )
- {
- this->permissionAccess = permissionAccess;
- this->name = name;
- this->machineName = machineName;
- }
-
- property String^ Name
- {
- String^ get()
- {
- return this->name;
- }
- }
-
- property String^ MachineName
- {
- String^ get()
- {
- return this->machineName;
- }
- }
-
- property MailslotPermissionAccess PermissionAccess
- {
- MailslotPermissionAccess get()
- {
- return this->permissionAccess;
- }
- }
-};
-
-
-[Serializable]
-public ref class MailslotPermission: public ResourcePermissionBase
-{
-private:
- ArrayList^ innerCollection;
- void SetNames()
- {
- this->PermissionAccessType = MailslotPermissionAccess::typeid;
- array^newStrings = {"Name","Machine"};
- this->TagNames = newStrings;
- }
-
-
-internal:
- void AddPermissionAccess( MailslotPermissionEntry^ entry )
- {
- ResourcePermissionBase::AddPermissionAccess( entry->GetBaseEntry() );
- }
-
- void Clear()
- {
- ResourcePermissionBase::Clear();
- }
-
- void RemovePermissionAccess( MailslotPermissionEntry^ entry )
- {
- ResourcePermissionBase::RemovePermissionAccess( entry->GetBaseEntry() );
- }
-
-
-public:
- MailslotPermission()
- {
- SetNames();
- }
-
- MailslotPermission( PermissionState state )
- : ResourcePermissionBase( state )
- {
- SetNames();
- }
-
- //
- MailslotPermission( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName )
- {
- SetNames();
- this->AddPermissionAccess( gcnew MailslotPermissionEntry( permissionAccess,name,machineName ) );
- }
-
- MailslotPermission( array^permissionAccessEntries )
- {
- SetNames();
- if ( permissionAccessEntries == nullptr )
- throw gcnew ArgumentNullException( "permissionAccessEntries" );
-
- for ( int index = 0; index < permissionAccessEntries->Length; ++index )
- this->AddPermissionAccess( permissionAccessEntries[ index ] );
- }
- //
-
- property ArrayList^ PermissionEntries
- {
- ArrayList^ get()
- {
- if ( this->innerCollection == nullptr )
- this->innerCollection = gcnew ArrayList;
-
- this->innerCollection->InsertRange( 0, safe_cast(ResourcePermissionBase::GetPermissionEntries()) );
- return this->innerCollection;
- }
- }
-};
-//
-
-void main(){}
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp
deleted file mode 100644
index f0687bcf481..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-using namespace System;
-using namespace System::Security::Permissions;
-
-//
- [assembly:FileDialogPermissionAttribute(SecurityAction::RequestMinimum,Unrestricted=true)];
- //In C++, you must specify that you are using the assembly scope when making a request.
-//
-
-namespace Snippet2
-{
-//
- [FileDialogPermissionAttribute(SecurityAction::Demand,Unrestricted=true)]
-//
- public ref class SampleClass{};
-}
-
-namespace Snippet3
-{
-//
- //[FileDialogPermissionAttribute(SecurityAction::Assert,Unrestricted=true)]
-//
- public ref class SampleClass{};
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp
deleted file mode 100644
index 6279477dcee..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-using namespace System;
-using namespace System::Security::Permissions;
-
-namespace Snippet1
-{
-//
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,ViewAndModify="C:\\example\\sample.txt")]
-//
- public ref class SampleClass{};
-}
-namespace Snippet2
-{
-//
- [FileIOPermissionAttribute(SecurityAction::Demand,Unrestricted=true)]
-//
- public ref class SampleClass{};
-}
-
-namespace Snippet3
-{
-//
- //[FileIOPermissionAttribute(SecurityAction::Assert,Unrestricted=true)]
-//
- public ref class SampleClass{};
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp
deleted file mode 100644
index da729d96fce..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Policy;
-using namespace System::Security::Principal;
-
-int main(array ^args)
-{
- System::String^ null;
- AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal);
- PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" );
- principalPerm->Demand();
- Console::WriteLine("Demand succeeded");
- return 0;
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp
deleted file mode 100644
index 0bde5631510..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Policy;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- TextBox^ textBox1;
-
-public:
- void Method()
- {
- //
- //Define users and roles.
- PrincipalPermission^ ppBob = gcnew PrincipalPermission( "Bob", "Manager" );
- PrincipalPermission^ ppLouise = gcnew PrincipalPermission( "Louise", "Supervisor" );
- PrincipalPermission^ ppGreg = gcnew PrincipalPermission( "Greg", "Employee" );
-
- //Define groups of users.
- PrincipalPermission^ pp1 = (PrincipalPermission^) (ppBob->Union( ppLouise ));
- PrincipalPermission^ pp2 = (PrincipalPermission^) (ppGreg->Union( pp1 ));
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp
deleted file mode 100644
index cbff0e29e8a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Policy;
-using namespace System::Security::Principal;
-
-[PrincipalPermission(SecurityAction::Demand, Role = "Administrators")]
-void CheckAdministrator()
-{
- Console::WriteLine("User is an administrator.");
-}
-int main(array ^args)
-{
- try
- {
- // Must set PrincipalPolicy to WindowsPrincipal
- AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal);
- // Check using declarative security.
- CheckAdministrator();
- // Check using Imperative security.
- System::String^ null;
- PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" );
- principalPerm->Demand();
- Console::WriteLine("Demand succeeded");
- }
- catch (Exception ^e)
- {
- Console::WriteLine(e->Message);
- }
- return 0;
-}
-
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp
deleted file mode 100644
index cef1b5fb817..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-
-//
-// This sample demonstrates the use of the PermissionSet class.
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security::Permissions;
-using namespace System::Security;
-using namespace System::IO;
-using namespace System::Collections;
-void PermissionSetDemo()
-{
- Console::WriteLine( "Executing PermissionSetDemo" );
- try
- {
- //
- // Open a new PermissionSet.
- PermissionSet^ ps1 = gcnew PermissionSet( PermissionState::None );
-
- Console::WriteLine( "Adding permission to open a file from a file dialog box." );
-
- //
- // Add a permission to the permission set.
- ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Open ) );
- //
-
- Console::WriteLine( "Demanding permission to open a file." );
- ps1->Demand();
- Console::WriteLine( "Demand succeeded." );
- //
- Console::WriteLine( "Adding permission to save a file from a file dialog box." );
- ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Save ) );
- Console::WriteLine( "Demanding permission to open and save a file." );
- ps1->Demand();
- Console::WriteLine( "Demand succeeded." );
- Console::WriteLine( "Adding permission to read environment variable USERNAME." );
- ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) );
- ps1->Demand();
- Console::WriteLine( "Demand succeeded." );
- Console::WriteLine( "Adding permission to read environment variable COMPUTERNAME." );
- ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"COMPUTERNAME" ) );
-
- //
- // Demand all the permissions in the set.
- Console::WriteLine( "Demand all permissions." );
- ps1->Demand();
- //
-
- Console::WriteLine( "Demand succeeded." );
-
- //
- // Display the number of permissions in the set.
- Console::WriteLine( "Number of permissions = {0}", ps1->Count );
- //
-
- //
- // Display the value of the IsSynchronized property.
- Console::WriteLine( "IsSynchronized property = {0}", ps1->IsSynchronized );
- //
-
- //
- // Display the value of the IsReadOnly property.
- Console::WriteLine( "IsReadOnly property = {0}", ps1->IsReadOnly );
- //
-
- //
- // Display the value of the SyncRoot property.
- Console::WriteLine( "SyncRoot property = {0}", ps1->SyncRoot );
- //
-
- //
- // Display the result of a call to the ContainsNonCodeAccessPermissions method.
- // Gets a value indicating whether the PermissionSet contains permissions
- // that are not derived from CodeAccessPermission.
- // Returns true if the PermissionSet contains permissions that are not
- // derived from CodeAccessPermission; otherwise, false.
- Console::WriteLine( "ContainsNonCodeAccessPermissions method returned {0}", ps1->ContainsNonCodeAccessPermissions() );
- //
-
- //
- Console::WriteLine( "Value of the permission set ToString = \n{0}", ps1->ToString() );
- //
-
- PermissionSet^ ps2 = gcnew PermissionSet( PermissionState::None );
-
- //
- // Create a second permission set and compare it to the first permission set.
- ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) );
- ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Write,"COMPUTERNAME" ) );
- IEnumerator^ list = ps1->GetEnumerator();
- Console::WriteLine("Permissions in first permission set:");
- while (list->MoveNext())
- Console::WriteLine(list->Current->ToString());
- Console::WriteLine( "Second permission IsSubsetOf first permission = {0}", ps2->IsSubsetOf( ps1 ) );
- //
-
- //
- // Display the intersection of two permission sets.
- PermissionSet^ ps3 = ps2->Intersect( ps1 );
- Console::WriteLine( "The intersection of the first permission set and the second permission set = {0}", ps3 );
- //
-
- // Create a new permission set.
- PermissionSet^ ps4 = gcnew PermissionSet( PermissionState::None );
- ps4->AddPermission( gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\Temp\\Testfile.txt" ) );
- ps4->AddPermission( gcnew FileIOPermission( static_cast(FileIOPermissionAccess::Read | FileIOPermissionAccess::Write | FileIOPermissionAccess::Append),"C:\\Temp\\Testfile.txt" ) );
- //
-
- // Display the union of two permission sets.
- PermissionSet^ ps5 = ps3->Union( ps4 );
- Console::WriteLine( "The union of permission set 3 and permission set 4 = {0}", ps5 );
- //
-
- //
- // Remove FileIOPermission from the permission set.
- ps5->RemovePermission( FileIOPermission::typeid );
- Console::WriteLine( "The last permission set after removing FileIOPermission = {0}", ps5 );
- //
-
- //
- // Change the permission set using SetPermission.
- ps5->SetPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::AllAccess,"USERNAME" ) );
- Console::WriteLine( "Permission set after SetPermission = {0}", ps5 );
- //
-
- //
- // Display result of ToXml and FromXml operations.
- PermissionSet^ ps6 = gcnew PermissionSet( PermissionState::None );
- ps6->FromXml( ps5->ToXml() );
- Console::WriteLine( "Result of ToFromXml = {0}\n", ps6 );
- //
-
- //
- // Display results of PermissionSet::GetEnumerator.
- IEnumerator^ psEnumerator = ps1->GetEnumerator();
- while ( psEnumerator->MoveNext() )
- {
- Console::WriteLine( psEnumerator->Current );
- }
- //
-
- //
- // Check for an unrestricted permission set.
- PermissionSet^ ps7 = gcnew PermissionSet( PermissionState::Unrestricted );
- Console::WriteLine( "Permission set is unrestricted = {0}", ps7->IsUnrestricted() );
- //
-
- //
- // Create and display a copy of a permission set.
- ps7 = ps5->Copy();
- Console::WriteLine( "Result of copy = {0}", ps7 );
- //
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-
-}
-
-int main()
-{
- PermissionSetDemo();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp
deleted file mode 100644
index 67c13f7830e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#using "NameIdPermission.dll"
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Runtime::Remoting;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Reflection;
-using namespace MyPermission;
-
-// Use the command line option '/keyfile' or appropriate project settings to sign this assembly.
-[assembly:System::Security::AllowPartiallyTrustedCallersAttribute];
-[AttributeUsage(AttributeTargets::Method|AttributeTargets::Constructor|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Assembly,AllowMultiple=true,Inherited=false)]
-[Serializable]
-public ref class NameIdPermissionAttribute: public CodeAccessSecurityAttribute
-{
-private:
- String^ m_Name;
- bool m_unrestricted;
-
-public:
- NameIdPermissionAttribute( SecurityAction action )
- : CodeAccessSecurityAttribute( action )
- {
- m_Name = nullptr;
- m_unrestricted = false;
- }
-
-
- property String^ Name
- {
- String^ get()
- {
- return m_Name;
- }
-
- void set( String^ value )
- {
- m_Name = value;
- }
-
- }
- virtual IPermission^ CreatePermission() override
- {
- if ( m_unrestricted )
- {
- throw gcnew ArgumentException( "Unrestricted permissions not allowed in identity permissions." );
- }
- else
- {
- if ( m_Name == nullptr )
- return gcnew NameIdPermission( PermissionState::None );
- return gcnew NameIdPermission( m_Name );
- }
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp
deleted file mode 100644
index e1cfddf9959..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-
-//
-#using
-
-using namespace System;
-using namespace System::Security::Permissions;
-using namespace System::Security::Cryptography;
-using namespace System::Security;
-using namespace System::IO;
-
-[assembly:DataProtectionPermissionAttribute(
-SecurityAction::RequestMinimum,
-Flags=DataProtectionPermissionFlags::ProtectData)];
-public ref class DataProtect
-{
-private:
-
- // Create a byte array for additional entropy when using the
- // Protect and Unprotect methods.
- static array^ s_additionalEntropy = {9,8,7,6,5};
- static array^ encryptedSecret;
- static array^ originalData;
-
-public:
- static void Main()
- {
-
- //
- Console::WriteLine( "Creating a permission with the Flags property ="
- " ProtectData." );
- DataProtectionPermission ^ sp = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData );
-
- ProtectData();
- //
- sp->PermitOnly();
- // The following code results in an exception due to an attempt
- // to unprotect data.
- UnprotectData();
-
- // Remove the restrictive permission.
- CodeAccessPermission::RevertPermitOnly();
-
- // The untprotect call will now succeed.
- UnprotectData();
-
- // Demonstrate the behavior of the class members.
- ShowMembers();
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadKey();
- return;
- }
-
-
-private:
-
-
- // The following method is intended to demonstrate only the behavior of
- // DataProtectionPermission class members,and not their practical usage.
- // Most properties and methods in this class are used for the resolution
- // and enforcement of security policy by the security infrastructure code.
- static void ShowMembers()
- {
- Console::WriteLine( "Creating four DataProtectionPermissions" );
- Console::WriteLine( "Creating the first permission with the Flags "
- "property = ProtectData." );
- DataProtectionPermission ^ sp1 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData );
- Console::WriteLine( "Creating the second permission with the Flags "
- "property = AllFlags." );
- DataProtectionPermission ^ sp2 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::AllFlags );
- Console::WriteLine( "Creating the third permission with a permission "
- "state = Unrestricted." );
-
- //
- DataProtectionPermission ^ sp3 = gcnew DataProtectionPermission( PermissionState::Unrestricted );
-
- //
- Console::WriteLine( "Creating the fourth permission with a permission"
- " state = None." );
- DataProtectionPermission ^ sp4 = gcnew DataProtectionPermission( PermissionState::None );
-
- //
- bool rc = sp2->IsSubsetOf( sp3 );
- Console::WriteLine( "Is the permission with all flags set (AllFlags) "
- "a subset of \n \tthe permission with an Unrestricted "
- "permission state? {0}", (rc ? (String^)"Yes" : "No") );
- rc = sp1->IsSubsetOf( sp2 );
- Console::WriteLine( "Is the permission with ProtectData access a "
- "subset of the permission with \n"
- "\tAllFlags set? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- rc = sp3->IsUnrestricted();
- Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- Console::WriteLine( "Copying the second permission to the fourth "
- "permission." );
- sp4 = dynamic_cast(sp2->Copy());
- rc = sp4->Equals( sp2 );
- Console::WriteLine( "Is the fourth permission equal to the second "
- "permission? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- Console::WriteLine( "Creating the intersection of the second and "
- "first permissions." );
- sp4 = dynamic_cast(sp2->Intersect( sp1 ));
- Console::WriteLine( "The value of the Flags property is: {0}", sp4->Flags );
-
- //
- //
- Console::WriteLine( "Creating the union of the second and first "
- "permissions." );
- sp4 = dynamic_cast(sp2->Union( sp1 ));
- Console::WriteLine( "Result of the union of the second permission "
- "with the first: {0}", sp4->Flags );
-
- //
- //
- Console::WriteLine( "Using an XML round trip to reset the fourth "
- "permission." );
- sp4->FromXml( sp2->ToXml() );
- rc = sp4->Equals( sp2 );
- Console::WriteLine( "Does the XML round trip result equal the "
- "original permission? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- }
-
-
-public:
-
- // Create a simple byte array containing data to be encrypted.
- static void ProtectData()
- {
- array^secret = {0,1,2,3,4,1,2,3,4};
-
- //Encrypt the data.
- encryptedSecret = Protect( secret );
- Console::WriteLine( "The encrypted byte array is:" );
- if ( encryptedSecret != nullptr )
- PrintValues( encryptedSecret );
- }
-
-
- // Decrypt the data and store in a byte array.
- static void UnprotectData()
- {
- originalData = Unprotect( encryptedSecret );
- if ( originalData != nullptr )
- {
- Console::WriteLine( "\r\nThe original data is:" );
- PrintValues( originalData );
- }
- }
-
-
- // Encrypt data in the specified byte array.
- static array^ Protect( array^data )
- {
- try
- {
-
- // Encrypt the data using DataProtectionScope.CurrentUser.
- // The result can be decrypted only by the user who encrypted
- // the data.
- return ProtectedData::Protect( data, s_additionalEntropy, DataProtectionScope::CurrentUser );
- }
- catch ( CryptographicException^ e )
- {
- Console::WriteLine( "Data was not encrypted. "
- "An error has occurred." );
- Console::WriteLine( e );
- return nullptr;
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "Insufficient permissions. "
- "An error has occurred." );
- Console::WriteLine( e );
- return nullptr;
- }
-
- }
-
-
- // Decrypt data in the specified byte array.
- static array^ Unprotect( array^data )
- {
- try
- {
-
- //Decrypt the data using DataProtectionScope.CurrentUser.
- return ProtectedData::Unprotect( data, s_additionalEntropy, DataProtectionScope::CurrentUser );
- }
- catch ( CryptographicException^ e )
- {
- Console::WriteLine( "Data was not decrypted. "
- "An error has occurred." );
- Console::WriteLine( e );
- return nullptr;
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "Insufficient permissions. "
- "An error has occurred." );
- Console::WriteLine( e );
- return nullptr;
- }
-
- }
-
- static void PrintValues( array^myArr )
- {
- System::Collections::IEnumerator^ myEnum = myArr->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Byte i = safe_cast(myEnum->Current);
- Console::Write( "\t{0}", i );
- }
-
- Console::WriteLine();
- }
-
-};
-
-int main()
-{
- DataProtect::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp
deleted file mode 100644
index 8f6d1b640df..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-
-// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml,
-// GetPathList and SetPathList methods, and the AllFiles and AllLocalFiles properties
-// of the FileIOPermission class.
-//
-using namespace System::Runtime::InteropServices;
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Collections;
-
-// This class generates FileIOPermission objects.
-
-[assembly:CLSCompliant(true)];
-private ref class FileIOGenerator
-{
-private:
- array^myFile;
- array^myAccess;
- int fileIndex;
-
-public:
- FileIOGenerator()
- {
- array^tempFile = {"C:\\Examples\\Test\\TestFile.txt","C:\\Examples\\Test\\","C:\\Examples\\Test\\..","C:\\Temp"};
- myFile = tempFile;
- array^ tempAccess = {FileIOPermissionAccess::AllAccess,FileIOPermissionAccess::Append,FileIOPermissionAccess::NoAccess,FileIOPermissionAccess::PathDiscovery,FileIOPermissionAccess::Read,FileIOPermissionAccess::Write};
- myAccess = tempAccess;
- ResetIndex();
- }
-
- void ResetIndex()
- {
- fileIndex = 0;
- }
-
-
- // Create a file path.
- //
- bool CreateFilePath( [Out]interior_ptr file )
- {
- if ( fileIndex == myFile->Length )
- {
- *file = "";
- fileIndex++;
- return true;
- }
-
- if ( fileIndex > myFile->Length )
- {
- *file = "";
- return false;
- }
-
- *file = myFile[ fileIndex++ ];
- try
- {
- return true;
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Cannot create FileIOPermission: {0} {1}", *file, e );
- *file = "";
- return true;
- }
-
- }
-
- //
-};
-
-public ref class FileIOPermissionDemo
-{
-private:
-
- // IsSubsetOf determines whether the current permission is a subset of the specified permission.
- // This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess.
- //
- bool IsSubsetOfDemo()
- {
- bool returnValue = true;
- String^ fileIO1;
- String^ fileIO2;
- FileIOPermission^ fileIOPerm1;
- FileIOPermission^ fileIOPerm2;
- FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
- FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
- fileIOGen1->ResetIndex();
- while ( fileIOGen1->CreateFilePath( &fileIO1 ) )
- {
- if (fileIO1 == "")
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO1);
-
- Console::WriteLine( "**********************************************************\n" );
- fileIOGen2->ResetIndex();
- while ( fileIOGen2->CreateFilePath( &fileIO2 ) )
- {
- if (fileIO2 == "")
- fileIOPerm2 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO2);
- String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1;
- String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2;
- if ( fileIOPerm2 == nullptr )
- continue;
- try
- {
- if ( fileIOPerm1->IsSubsetOf( fileIOPerm2 ) )
- {
- Console::WriteLine( "{0} is a subset of {1}\n", firstPermission, secondPermission );
- }
- else
- {
- Console::WriteLine( "{0} is not a subset of {1}\n", firstPermission, secondPermission );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown for subset :{0}\n{1}\n{2}", (fileIO1->Equals( "" ) ? "null" : fileIO1), (fileIO2->Equals( "" ) ? "null" : fileIO2), e );
- }
-
- }
- }
-
- return returnValue;
- }
-
-
- //
- // Union creates a new permission that is the union of the current permission and the specified permission.
- //
- bool UnionDemo()
- {
- bool returnValue = true;
- String^ fileIO1;
- String^ fileIO2;
- FileIOPermission^ fileIOPerm1;
- FileIOPermission^ fileIOPerm2;
- IPermission^ fileIOPerm3;
- FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
- FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
- fileIOGen1->ResetIndex();
- while ( fileIOGen1->CreateFilePath( &fileIO1 ) )
- {
- if (fileIO1 == "")
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1);
-
- Console::WriteLine( "**********************************************************\n" );
- fileIOGen2->ResetIndex();
- while ( fileIOGen2->CreateFilePath( &fileIO2 ) )
- {
- if (fileIO2 == "")
- fileIOPerm2 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2);
- try
- {
- if ( fileIOPerm2 == nullptr )
- continue;
- String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1;
- String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2;
- fileIOPerm3 = dynamic_cast(fileIOPerm1->Union( fileIOPerm2 ));
- fileIOPerm3 = fileIOPerm1->Union( fileIOPerm2 );
- if ( fileIOPerm3 == nullptr )
- {
- Console::WriteLine( "The union of {0} and {1} is null.", firstPermission, secondPermission );
- }
- else
- {
- Console::WriteLine( "The union of {0} and {1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown for union {0}", e );
- returnValue = false;
- }
-
- }
- }
-
- return returnValue;
- }
-
-
- //
- // Intersect creates and returns a new permission that is the intersection of the current
- // permission and the permission specified.
- //
- bool IntersectDemo()
- {
- bool returnValue = true;
- String^ fileIO1;
- String^ fileIO2;
- FileIOPermission^ fileIOPerm1;
- FileIOPermission^ fileIOPerm2;
- FileIOPermission^ fileIOPerm3;
- FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
- FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
- fileIOGen1->ResetIndex();
- while ( fileIOGen1->CreateFilePath ( &fileIO1 ) )
- {
- if (fileIO1 == "")
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1);
-
- Console::WriteLine( "**********************************************************\n" );
- fileIOGen2->ResetIndex();
- while ( fileIOGen2->CreateFilePath( &fileIO2 ) )
- {
- if (fileIO2 == "")
- fileIOPerm2 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2);
- String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1;
- String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2;
- try
- {
- fileIOPerm3 = dynamic_cast(fileIOPerm1->Intersect( fileIOPerm2 ));
- if ( fileIOPerm3 != nullptr && fileIOPerm3->GetPathList( FileIOPermissionAccess::Read ) != nullptr )
- {
- Console::WriteLine( "The intersection of {0} and \n\t{1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] );
- }
- else
- {
- Console::WriteLine( "The intersection of {0} and {1} is null.", firstPermission, secondPermission );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown for intersection {0}", e );
- returnValue = false;
- }
-
- }
- }
-
- return returnValue;
- }
-
-
- //
- //Copy creates and returns an identical copy of the current permission.
- //
- bool CopyDemo()
- {
- bool returnValue = true;
- String^ fileIO1;
- FileIOPermission^ fileIOPerm1;
- FileIOPermission^ fileIOPerm2;
- FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
- FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
- fileIOGen1->ResetIndex();
- while ( fileIOGen1->CreateFilePath( &fileIO1 ) )
- {
- if (fileIO1 == "")
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1);
-
- Console::WriteLine( "**********************************************************\n" );
- fileIOGen2->ResetIndex();
- try
- {
- fileIOPerm2 = dynamic_cast(fileIOPerm1->Copy());
- if ( fileIOPerm2 != nullptr )
- {
- Console::WriteLine( "Result of copy = {0}\n", fileIOPerm2 );
- }
- else
- {
- Console::WriteLine( "Result of copy is null. \n" );
- }
- }
- catch ( Exception^ e )
- {
- {
- if ( fileIO1->Equals( "" ) )
- {
- Console::WriteLine( "The target FileIOPermission is empty, copy failed." );
- }
- else
- Console::WriteLine( e );
- }
- continue;
- }
-
- }
-
- return returnValue;
- }
-
-
- //
- // ToXml creates an XML encoding of the permission and its current state;
- // FromXml reconstructs a permission with the specified state from the XML encoding.
- //
- bool ToFromXmlDemo()
- {
- bool returnValue = true;
- String^ fileIO1;
- FileIOPermission^ fileIOPerm1;
- FileIOPermission^ fileIOPerm2;
- FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
- FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
- fileIOGen1->ResetIndex();
- while ( fileIOGen1->CreateFilePath( &fileIO1 ) )
- {
- if (fileIO1 == "")
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
- else
- fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1);
-
- Console::WriteLine( "********************************************************\n" );
- fileIOGen2->ResetIndex();
- try
- {
- fileIOPerm2 = gcnew FileIOPermission( PermissionState::None );
- fileIOPerm2->FromXml( fileIOPerm1->ToXml() );
- Console::WriteLine( "Result of ToFromXml = {0}\n", fileIOPerm2 );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "ToFromXml failed :{0}{1}", fileIOPerm1, e );
- continue;
- }
-
- }
-
- return returnValue;
- }
-
-
- //
- // AddPathList adds access for the specified files and directories to the existing state of the permission.
- // SetPathList sets the specified access to the specified files and directories, replacing the existing state
- // of the permission.
- // GetPathList gets all files and directories that have the specified FileIOPermissionAccess.
- //
- bool SetGetPathListDemo()
- {
- try
- {
- Console::WriteLine( "********************************************************\n" );
- FileIOPermission^ fileIOPerm1;
- Console::WriteLine( "Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt" );
-
- //
- fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" );
-
- //
- Console::WriteLine( "Adding 'C:\\Temp' to the write access list, and \n 'C:\\Examples\\Test' to read access." );
- fileIOPerm1->AddPathList( FileIOPermissionAccess::Write, "C:\\Temp" );
- fileIOPerm1->AddPathList( FileIOPermissionAccess::Read, "C:\\Examples\\Test" );
- array^paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read );
- Console::WriteLine( "Read access before SetPathList = " );
- IEnumerator^ myEnum = paths->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ path = safe_cast(myEnum->Current);
- Console::WriteLine( "\t{0}", path );
- }
-
- Console::WriteLine( "Setting the read access list to \n'C:\\Temp'" );
- fileIOPerm1->SetPathList( FileIOPermissionAccess::Read, "C:\\Temp" );
- paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read );
- Console::WriteLine( "Read access list after SetPathList = " );
- IEnumerator^ myEnum1 = paths->GetEnumerator();
- while ( myEnum1->MoveNext() )
- {
- String^ path = safe_cast(myEnum1->Current);
- Console::WriteLine( "\t{0}", path );
- }
-
- paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Write );
- Console::WriteLine( "Write access list after SetPathList = " );
- IEnumerator^ myEnum2 = paths->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- String^ path = safe_cast(myEnum2->Current);
- Console::WriteLine( "\t{0}", path );
- }
-
- Console::WriteLine( "Write access = \n{0}", fileIOPerm1->GetPathList( FileIOPermissionAccess::AllAccess ) );
- }
- catch ( ArgumentException^ e )
- {
-
- // FileIOPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
- Console::WriteLine( "An ArgumentException occurred as a result of using AllAccess. This property cannot be used as a parameter in GetPathList because it represents more than one type of file variable access. : \n{0}", e );
- }
-
- return true;
- }
-
-
- //
- // The AllFiles property gets or sets the permitted access to all files.
- // The AllLocalFiles property gets or sets the permitted access to all local files.
- //
- bool AllFilesDemo()
- {
- try
- {
- Console::WriteLine( "********************************************************\n" );
- FileIOPermission^ fileIOPerm1;
- Console::WriteLine( "Creating a FileIOPermission and adding read access for all files" );
- fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" );
- fileIOPerm1->AllFiles = FileIOPermissionAccess::Read;
- Console::WriteLine( "AllFiles access = {0}", fileIOPerm1->AllFiles );
- Console::WriteLine( "Adding AllAccess rights for local files." );
- fileIOPerm1->AllLocalFiles = FileIOPermissionAccess::AllAccess;
- Console::WriteLine( "AllLocalFiles access = {0}", fileIOPerm1->AllLocalFiles );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( e );
- return false;
- }
-
- return true;
- }
-
-
-public:
-
- //
- // Invoke all demos.
- bool RunDemo()
- {
- bool ret = true;
- bool retTmp;
-
- // Call the IsSubsetOfPath demo.
- if ( retTmp = IsSubsetOfDemo() )
- Console::WriteLine( "IsSubsetOf demo completed successfully." );
- else
- Console::WriteLine( "IsSubsetOf demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Union demo.
- if ( retTmp = UnionDemo() )
- Console::WriteLine( "Union demo completed successfully." );
- else
- Console::WriteLine( "Union demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Intersect demo.
- if ( retTmp = IntersectDemo() )
- Console::WriteLine( "Intersect demo completed successfully." );
- else
- Console::WriteLine( "Intersect demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Copy demo.
- if ( retTmp = CopyDemo() )
- Console::WriteLine( "Copy demo completed successfully." );
- else
- Console::WriteLine( "Copy demo failed." );
-
- ret = retTmp && ret;
-
- // Call the ToFromXml demo.
- if ( retTmp = ToFromXmlDemo() )
- Console::WriteLine( "ToFromXml demo completed successfully." );
- else
- Console::WriteLine( "ToFromXml demo failed." );
-
- ret = retTmp && ret;
-
- // Call the SetGetPathList demo.
- if ( retTmp = SetGetPathListDemo() )
- Console::WriteLine( "SetGetPathList demo completed successfully." );
- else
- Console::WriteLine( "SetGetPathList demo failed." );
-
- ret = retTmp && ret;
-
- // Call the AllFiles demo.
- if ( retTmp = AllFilesDemo() )
- Console::WriteLine( "AllFiles demo completed successfully." );
- else
- Console::WriteLine( "AllFiles demo failed." );
-
- ret = retTmp && ret;
- return (ret);
- }
-
-};
-
-
-// Test harness.
-int main()
-{
- try
- {
- FileIOPermissionDemo^ democase = gcnew FileIOPermissionDemo;
- bool ret = democase->RunDemo();
- if ( ret )
- {
- Console::WriteLine( "FileIOPermission demo completed successfully." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 100;
- }
- else
- {
- Console::WriteLine( "FileIOPermission demo failed." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "FileIOPermission demo failed" );
- Console::WriteLine( e );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
-
-}
-
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp
deleted file mode 100644
index 6593317f496..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-
-int main()
-{
- try
- {
- FileIOPermission^ fileIOPerm1;
- fileIOPerm1 = gcnew FileIOPermission(PermissionState::Unrestricted);
-
- // Tests for: SetPathList(FileIOPermissionAccess,String)
-
- // Test the Read list
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\documents");
-
- Console::WriteLine("Read access before SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read))
- {
- Console::WriteLine("\t" + path);
- }
-
- //
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\temp");
- //
-
- Console::WriteLine("Read access after SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read))
- {
- Console::WriteLine("\t" + path);
- }
-
- // Test the Write list
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\temp");
-
- Console::WriteLine("Write access before SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write))
- {
- Console::WriteLine("\t" + path);
- }
- //
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\documents");
- //
-
- Console::WriteLine("Write access after SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write))
- {
- Console::WriteLine("\t" + path);
- }
-
- // Tests for: SetPathList(FileIOPermissionAccess,String[])
-
- // Test the Read list
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\pictures", "C:\\music"});
-
- Console::WriteLine("Read access before SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read))
- {
- Console::WriteLine("\t" + path);
- }
-
- //
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\temp", "C:\\Documents"});
- //
-
- Console::WriteLine("Read access after SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read))
- {
- Console::WriteLine("\t" + path);
- }
-
- // Test the Write list
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\temp", "C:\\Documents"});
-
- Console::WriteLine("Write access before SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write))
- {
- Console::WriteLine("\t" + path);
- }
- //
- fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\pictures", "C:\\music"});
- //
-
- Console::WriteLine("Write access after SetPathList = ");
- for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write))
- {
- Console::WriteLine("\t" + path);
- }
- }
- catch (Exception^ ex)
- {
- Console::WriteLine(ex->Message);
- }
-}
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp
deleted file mode 100644
index da97ffa6c9f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-
-//
-// This sample demonstrates the use of the FileIOPermissionAttribute class.
-// The sample follows the recommended procedure of first granting PermitOnly permissions,
-// then using a Deny on that set of granted permissions.
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security::Permissions;
-using namespace System::Security;
-using namespace System::IO;
-void PermitOnlyMethod();
-void PermitOnlyTestMethod();
-void TestFailed();
-
-
-// This method demonstrates the use of the FileIOPermissionAttribute to create a PermitOnly permission.
-//
-//
-// Set the Read property.
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,Read="C:\\")]
-//
-//
-// Set the PathDiscovery property.
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,
-PathDiscovery="C:\\Documents and Settings\\All Users")]
-//
-//
-// Set the Append property.
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,
-Append="C:\\Documents and Settings\\All Users\\Application Data")]
-//
-//
-// Set the Write property.
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,
-Write="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft")]
-//
-//
-// Set the All property.
-[FileIOPermissionAttribute(SecurityAction::PermitOnly,
-All="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network")]
-//
-
-void PermitOnlyMethod()
-{
- Console::WriteLine( "Executing PermitOnlyMethod." );
- Console::WriteLine( "PermitOnly the Read permission for drive C." );
- Console::WriteLine( "PermitOnly the PathDiscovery permission for \n\tC:\\Documents and Settings\\All Users." );
- Console::WriteLine( "PermitOnly the Append permission for \n\tC:\\Documents and Settings\\All Users\\Application Data." );
- Console::WriteLine( "PermitOnly the Write permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft." );
- Console::WriteLine( "PermitOnly the All permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network." );
- PermitOnlyTestMethod();
-}
-//
-
-void PermitOnlyTestMethod()
-{
- Console::WriteLine("Executing PermitOnlyTestMethod.");
- try
- {
- PermissionSet^ ps = gcnew PermissionSet(PermissionState::None);
- ps->AddPermission(gcnew FileIOPermission(FileIOPermissionAccess::Write,
- "C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile"));
- Console::WriteLine("Demanding permission to write " +
- "'C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile'");
- ps->Demand();
- Console::WriteLine("Demand succeeded.");
- ps->AddPermission(
- gcnew FileIOPermission(FileIOPermissionAccess::Write,
- "C:\\"));
- Console::WriteLine("Demanding permission to write to drive C.");
-
- // This demand should cause an exception.
- ps->Demand();
- // The TestFailed method is called if an exception is not thrown.
- TestFailed();
- }
- catch (Exception^ e)
- {
- Console::WriteLine("An exception was thrown because of a write demand: " + e->Message);
- }
-}
-
-void TestFailed()
-{
- Console::WriteLine( "Executing TestFailed." );
- Console::WriteLine( "Throwing an exception." );
- throw gcnew Exception;
-}
-
-int main()
-{
- try
- {
- PermitOnlyMethod();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp
deleted file mode 100644
index 0f1fb73c3e7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-public ref class GacIdentityPermissionDemo
-{
-private:
-
- //
- // IsSubsetOf determines whether the current permission is a subset of the specified permission.
- bool IsSubsetOfDemo()
- {
- try
- {
-
- //
- GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
- GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission( PermissionState::None );
- if ( Gac1->Equals( Gac2 ) )
- Console::WriteLine( "GacIdentityPermission() equals GacIdentityPermission(PermissionState.None)." );
-
-
- //
- if ( Gac1->IsSubsetOf( Gac2 ) )
- {
- Console::WriteLine( "{0} is a subset of {1}", Gac1, Gac2 );
- }
- else
- {
- Console::WriteLine( "{0} is not a subset of {1}", Gac1, Gac2 );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown : {0}", e );
- return false;
- }
-
- return true;
- }
-
-
- //
- //
- // Union creates a new permission that is the union of the current permission
- // and the specified permission.
- bool UnionDemo()
- {
-
- //
- GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission( PermissionState::None );
-
- //
- //
- GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission;
-
- //
- try
- {
- GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Union( Gac2 ));
- if ( p3 != nullptr )
- {
- Console::WriteLine( "The union of two GacIdentityPermissions was successful." );
- }
- else
- {
- Console::WriteLine( "The union of two GacIdentityPermissions failed." );
- return false;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown : {0}", e );
- return false;
- }
-
- return true;
- }
-
-
- //
- //
- // Intersect creates and returns a new permission that is the intersection of the
- // current permission and the specified permission.
- bool IntersectDemo()
- {
- GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
- GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission;
- try
- {
- GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Intersect( Gac2 ));
- if ( p3 != nullptr )
- {
- Console::WriteLine( "The intersection of the two permissions = {0}\n", p3 );
- }
- else
- {
- Console::WriteLine( "The intersection of the two permissions is null.\n" );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception was thrown : {0}", e );
- return false;
- }
-
- return true;
- }
-
-
- //
- //
- //Copy creates and returns an identical copy of the current permission.
- bool CopyDemo()
- {
- GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
- GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission;
- Console::WriteLine( "**************************************************************************" );
- try
- {
- Gac2 = dynamic_cast(Gac1->Copy());
- if ( Gac2 != nullptr )
- {
- Console::WriteLine( "Result of copy = {0}\n", Gac2 );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Copy failed : {0}{1}", Gac1, e );
- return false;
- }
-
- return true;
- }
-
-
- //
- //
- // ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
- // permission with the specified state from the XML encoding.
- bool ToFromXmlDemo()
- {
- GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
- GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission;
- Console::WriteLine( "**************************************************************************" );
- try
- {
- Gac2 = gcnew GacIdentityPermission( PermissionState::None );
- Gac2->FromXml( Gac1->ToXml() );
- bool result = Gac2->Equals( Gac1 );
- if ( Gac2->IsSubsetOf( Gac1 ) && Gac1->IsSubsetOf( Gac2 ) )
- {
- Console::WriteLine( "Result of ToFromXml = {0}", Gac2 );
- }
- else
- {
- Console::WriteLine( Gac2 );
- Console::WriteLine( Gac1 );
- return false;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "ToFromXml failed. {0}", e );
- return false;
- }
-
- return true;
- }
-
-
-public:
-
- //
- // Invoke all demos.
- bool RunDemo()
- {
- bool returnCode = true;
- bool tempReturnCode;
-
- // Call the IsSubsetOf demo.
- if ( tempReturnCode = IsSubsetOfDemo() )
- Console::WriteLine( "IsSubsetOf demo completed successfully." );
- else
- Console::WriteLine( "Subset demo failed." );
-
- returnCode = tempReturnCode && returnCode;
-
- // Call the Union demo.
- if ( tempReturnCode = UnionDemo() )
- Console::WriteLine( "Union demo completed successfully." );
- else
- Console::WriteLine( "Union demo failed." );
-
- returnCode = tempReturnCode && returnCode;
-
- // Call the Intersect demo.
- if ( tempReturnCode = IntersectDemo() )
- Console::WriteLine( "Intersect demo completed successfully." );
- else
- Console::WriteLine( "Intersect demo failed." );
-
- returnCode = tempReturnCode && returnCode;
-
- // Call the Copy demo.
- if ( tempReturnCode = CopyDemo() )
- Console::WriteLine( "Copy demo completed successfully." );
- else
- Console::WriteLine( "Copy demo failed." );
-
- returnCode = tempReturnCode && returnCode;
-
- // Call the ToFromXML demo.
- if ( tempReturnCode = ToFromXmlDemo() )
- Console::WriteLine( "ToFromXML demo completed successfully." );
- else
- Console::WriteLine( "ToFromXml demo failed." );
-
- returnCode = tempReturnCode && returnCode;
- return (returnCode);
- }
-
-};
-
-
-// Test harness.
-int main()
-{
- try
- {
- GacIdentityPermissionDemo^ testcase = gcnew GacIdentityPermissionDemo;
- bool returnCode = testcase->RunDemo();
- if ( returnCode )
- {
- Console::WriteLine( "The GacIdentityPermission demo completed successfully." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 100;
- }
- else
- {
- Console::WriteLine( "The GacIdentityPermission demo failed." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The GacIdentityPermission demo failed." );
- Console::WriteLine( e );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
-
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp
deleted file mode 100644
index 19d961987aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-
-//
-// To run this sample you must create a strong-name key named snkey.snk
-// using the Strong Name tool (sn.exe). Both the library assembly and the
-// application assembly that calls it must be signed with that key.
-// To run successfully, the application assembly must be in the global
-// assembly cache.
-// This console application can be created using the following code.
-
-//#using
-//#using
-//using namespace System;
-//using namespace System::Security;
-//using namespace System::Reflection;
-//using namespace ClassLibrary1;
-//[assembly: AssemblyVersion(S"1.0.555.0")]
-//[assembly: AssemblyKeyFile(S"snKey.snk")];
-//int main()
-//{
-// try
-// {
-// Class1* myLib = new Class1();
-// myLib->DoNothing();
-//
-// Console::WriteLine(S"Exiting the sample.");
-// }
-// catch (Exception* e)
-// {
-// Console::WriteLine(e->Message);
-// }
-//}
-using namespace System;
-using namespace System::Security::Permissions;
-
-namespace ClassLibrary1
-{
- //
- // Demand that the calling program be in the global assembly cache.
- [GacIdentityPermissionAttribute(SecurityAction::Demand)]
- public ref class Class1
- //
- {
- public:
- void DoNothing()
- {
- Console::WriteLine( "Exiting the library program." );
- }
- };
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp
deleted file mode 100644
index 6d805d4667a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Threading;
-using namespace System::Security;
-using namespace System::Security::Policy;
-using namespace System::Security::Principal;
-using namespace System::Security::Permissions;
-using namespace System::Diagnostics;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-using namespace System::Security::Permissions;
-
-//
-// The following class is an example of code that exposes external process management.
-// Add the LicenseProviderAttribute to the control.
-
-[LicenseProvider(LicFileLicenseProvider::typeid)]
-public ref class MyControl: public System::Windows::Forms::Control
-{
-private:
-
- // Create a new, null license.
- License^ license;
-
-public:
- [HostProtection(ExternalProcessMgmt=true)]
- MyControl()
- {
- license = nullptr;
-
- // Determine if a valid license can be granted.
- bool isValid = LicenseManager::IsValid( MyControl::typeid );
- Console::WriteLine( "The result of the IsValid method call is {0}", isValid );
- }
-
-};
-//
-
-// If this application is run on a server that implements host protection, the HostProtection attribute
-// is applied. If the application is run on a server that is not host-protected, the attribute
-// evaporates; it is not detected and therefore not applied. HostProtection can be configured with
-// members of the HostProtectionResource enumeration to customize the protection offered.
-// The primary intent of this sample is to show situations in which the HostProtection attribute
-// might be meaningfully used. The environment required to demonstrate a particular HostProtection is
-// too complex to invoke within the scope of this sample.
-public ref class HostProtectionExample
-{
-public:
- static int Success = 100;
-
-private:
-
- //
- // Use the enumeration flags to indicate that this method exposes shared state and
- // self-affecting process management.
- // Either of the following attribute statements can be used to set the
- // resource flags.
- // Exit the sample when an exception is thrown.
-
- [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)]
- [HostProtection(Resources=HostProtectionResource::SharedState|
- HostProtectionResource::SelfAffectingProcessMgmt)]
- static void Exit( String^ Message, int Code )
- {
- Console::WriteLine( "\nFAILED: {0} {1}", Message, Code );
- Environment::ExitCode = Code;
- Environment::Exit( Code );
- }
- //
-
- //
- // Use the enumeration flags to indicate that this method exposes shared state,
- // self-affecting process management, and self-affecting threading.
- // This method allows the user to quit the sample.
-
- [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true,
- SelfAffectingThreading=true,UI=true)]
- static void ExecuteBreak()
- {
- Console::WriteLine( "Executing Debugger.Break." );
- Debugger::Break();
- Debugger::Log( 1, "info", "test message" );
- }
- //
-
- //
- // Use the enumeration flags to indicate that this method exposes shared state,
- // self-affecting threading and the security infrastructure.
- // ApplyIdentity sets the current identity.
-
- [HostProtection(SharedState=true,SelfAffectingThreading=true,
- SecurityInfrastructure=true)]
- static int ApplyIdentity()
- {
- array^roles = {"User"};
- try
- {
- AppDomain^ mAD = AppDomain::CurrentDomain;
- GenericPrincipal^ mGenPr = gcnew GenericPrincipal( WindowsIdentity::GetCurrent(),roles );
- mAD->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal );
- mAD->SetThreadPrincipal( mGenPr );
- return Success;
- }
- catch ( Exception^ e )
- {
- Exit( e->ToString(), 5 );
- }
-
- return 0;
- }
- //
-
-public:
-
- // The following method is started on a separate thread.
- [PermissionSet(SecurityAction::Demand, Name="FullTrust")]
- static void WatchFileEvents()
- {
- try
- {
- Console::WriteLine( "In the child thread." );
- FileSystemWatcher^ watcher = gcnew FileSystemWatcher;
- watcher->Path = "C:\\Temp";
-
- // Watch for changes in LastAccess and LastWrite times, and
- // name changes to files or directories.
- watcher->NotifyFilter = static_cast(NotifyFilters::LastAccess | NotifyFilters::LastWrite | NotifyFilters::FileName | NotifyFilters::DirectoryName);
-
- // Watch only text files.
- watcher->Filter = "*.txt";
-
- // Add event handlers.
- watcher->Changed += gcnew FileSystemEventHandler( OnChanged );
- watcher->Created += gcnew FileSystemEventHandler( OnChanged );
- watcher->Deleted += gcnew FileSystemEventHandler( OnChanged );
-
- // Begin watching.
- watcher->EnableRaisingEvents = true;
-
- // Wait for the user to quit the program.
- Console::WriteLine( "Event handlers have been enabled." );
- while ( Console::Read() != 'q' )
- ;
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-
- }
-
-
-private:
-
- //
- // Use the enumeration flags to indicate that this method exposes synchronization
- // and external threading.
-
- [HostProtection(Synchronization=true,ExternalThreading=true)]
- static void StartThread()
- {
- Thread^ t = gcnew Thread( gcnew ThreadStart( WatchFileEvents ) );
-
- // Start the new thread. On a uniprocessor, the thread is not given
- // any processor time until the main thread yields the processor.
- t->Start();
-
- // Give the new thread a chance to execute.
- Thread::Sleep( 1000 );
- }
- //
-
-public:
-
- // Call methods that show the use of the HostProtectionResource enumeration.
- [HostProtection(Resources=HostProtectionResource::All)]
- static int Main()
- {
- try
- {
-
- // Show use of the HostProtectionResource.SharedState,
- // HostProtectionResource.SelfAffectingThreading, and
- // HostProtectionResource.Security enumeration values.
- ApplyIdentity();
- Directory::CreateDirectory( "C:\\Temp" );
-
- // Show use of the HostProtectionResource.Synchronization and
- // HostProtectionResource.ExternalThreading enumeration values.
- StartThread();
- Console::WriteLine( "In the main thread." );
- Console::WriteLine( "Deleting and creating 'MyTestFile.txt'." );
- if ( File::Exists( "C:\\Temp\\MyTestFile.txt" ) )
- {
- File::Delete( "C:\\Temp\\MyTestFile.txt" );
- }
- StreamWriter^ sr = File::CreateText( "C:\\Temp\\MyTestFile.txt" );
- sr->WriteLine( "This is my file." );
- sr->Close();
- Thread::Sleep( 1000 );
-
- // Show use of the HostProtectionResource.SharedState,
- // HostProtectionResource.SelfProcessMgmt,
- // HostProtectionResource.SelfAffectingThreading, and
- // HostProtectionResource.UI enumeration values.
- ExecuteBreak();
-
- // Show the use of the HostProtectionResource.ExternalProcessManagement enumeration value.
- MyControl^ myControl = gcnew MyControl;
- Console::WriteLine( "Enter 'q' to quit the sample." );
- return 100;
- }
- catch ( Exception^ e )
- {
- Exit( e->ToString(), 0 );
- return 0;
- }
- }
-
- // Define the event handlers.
- private:
- static void OnChanged( Object^ /*source*/, FileSystemEventArgs^ e )
- {
-
- // Specify whether a file is changed, created, or deleted.
- Console::WriteLine( "In the OnChanged event handler." );
- Console::WriteLine( "File: {0} {1}", e->FullPath, e->ChangeType );
- }
-
-};
-
-int main()
-{
- return HostProtectionExample::Main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp
deleted file mode 100644
index ac08770304c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Cryptography;
-
-public ref class KeyContainerPermissionDemo
-{
-private:
- static CspParameters^ cspParams = gcnew CspParameters;
- static RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider;
- static String^ providerName;
- static int providerType;
- static String^ myKeyContainerName;
-
- // Create three KeyContainerPermissionAccessEntry objects, each with a different constructor.
- //
- static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry1 = gcnew KeyContainerPermissionAccessEntry( "MyKeyContainer",KeyContainerPermissionFlags::Create );
-
- //
- //
- static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry2 = gcnew KeyContainerPermissionAccessEntry( cspParams,KeyContainerPermissionFlags::Open );
-
- //
- //
- static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry3 = gcnew KeyContainerPermissionAccessEntry( "Machine",providerName,providerType,myKeyContainerName,1,KeyContainerPermissionFlags::Open );
-
-public:
-
- //
- static int Main()
- {
- try
- {
-
- // Create a key container for use in the sample.
- GenKey_SaveInContainer( "MyKeyContainer" );
-
- // Initialize property values for creating a KeyContainerPermissionAccessEntry object.
- myKeyContainerName = rsa->CspKeyContainerInfo->KeyContainerName;
- providerName = rsa->CspKeyContainerInfo->ProviderName;
- providerType = rsa->CspKeyContainerInfo->ProviderType;
- cspParams->KeyContainerName = myKeyContainerName;
- cspParams->ProviderName = providerName;
- cspParams->ProviderType = providerType;
-
- // Display the KeyContainerPermissionAccessEntry properties using
- // the third KeyContainerPermissionAccessEntry object.
- DisplayAccessEntryMembers();
-
- //
- // Add access entry objects to a key container permission.
- KeyContainerPermission ^ keyContainerPerm1 = gcnew KeyContainerPermission( PermissionState::Unrestricted );
- Console::WriteLine( "Is the permission unrestricted? {0}", keyContainerPerm1->IsUnrestricted() );
- keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry1 );
- keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry2 );
-
- //
- // Display the permission.
- System::Console::WriteLine( keyContainerPerm1->ToXml() );
-
- //
- // Create an array of KeyContainerPermissionAccessEntry objects
- array^keyContainerPermAccEntryArray = {keyContainerPermAccEntry1,keyContainerPermAccEntry2};
-
- // Create a new KeyContainerPermission using the array.
- KeyContainerPermission ^ keyContainerPerm2 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::AllFlags,keyContainerPermAccEntryArray );
-
- //
- DisplayPermissionMembers( keyContainerPerm2, keyContainerPermAccEntryArray );
-
- // Demonstrate the effect of a deny for opening a key container.
- DenyOpen();
-
- // Demonstrate the deletion of a key container.
- DeleteContainer();
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadKey();
- return 0;
-
- // Close the current try block that did not expect an exception.
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Unexpected exception thrown: {0}", e->Message );
- return 0;
- }
-
- }
-
-
-private:
- static void DisplayAccessEntryMembers()
- {
-
- //
- Console::WriteLine( "\nKeycontainerName is {0}", keyContainerPermAccEntry3->KeyContainerName );
-
- //
- //
- Console::WriteLine( "KeySpec is {0}", (1 == keyContainerPermAccEntry3->KeySpec ? "AT_KEYEXCHANGE " : "AT_SIGNATURE") );
-
- //
- //
- Console::WriteLine( "KeyStore is {0}", keyContainerPermAccEntry3->KeyStore );
-
- //
- //
- Console::WriteLine( "ProviderName is {0}", keyContainerPermAccEntry3->ProviderName );
-
- //
- //
- Console::WriteLine( "ProviderType is {0}", (1 == keyContainerPermAccEntry3->ProviderType ? "PROV_RSA_FULL" : keyContainerPermAccEntry3->ProviderType.ToString()) );
-
- //
- //
- Console::WriteLine( "Hashcode = {0}", keyContainerPermAccEntry3->GetHashCode() );
-
- //
- //
- Console::WriteLine( "Are the KeyContainerPermissionAccessEntry objects equal? {0}", keyContainerPermAccEntry3->Equals( keyContainerPermAccEntry2 ) );
-
- //
- }
-
- static void DisplayPermissionMembers( KeyContainerPermission ^ keyContainerPerm2, array^keyContainerPermAccEntryArray )
- {
-
- // Display the KeyContainerPermission properties.
- //
- Console::WriteLine( "\nFlags value is {0}", keyContainerPerm2->Flags );
-
- //
- //
- KeyContainerPermission ^ keyContainerPerm3 = dynamic_cast(keyContainerPerm2->Copy());
- Console::WriteLine( "Is the copy equal to the original? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) );
-
- //
- //
- // Perform an XML roundtrip.
- keyContainerPerm3->FromXml( keyContainerPerm2->ToXml() );
- Console::WriteLine( "Was the XML roundtrip successful? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) );
-
- //
- KeyContainerPermission ^ keyContainerPerm4 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open,keyContainerPermAccEntryArray );
-
- //
- KeyContainerPermission ^ keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Intersect( keyContainerPerm4 ));
- Console::WriteLine( "Flags value after the intersection is {0}", keyContainerPerm5->Flags );
-
- //
- //
- keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Union( keyContainerPerm4 ));
-
- //
- //
- Console::WriteLine( "Flags value after the union is {0}", keyContainerPerm5->Flags );
-
- //
- //
- Console::WriteLine( "Is one permission a subset of the other? {0}", keyContainerPerm4->IsSubsetOf( keyContainerPerm2 ) );
-
- //
- }
-
- static void GenKey_SaveInContainer( String^ containerName )
- {
-
- // Create the CspParameters object and set the key container
- // name used to store the RSA key pair.
- cspParams = gcnew CspParameters;
- cspParams->KeyContainerName = containerName;
-
- // Create a new instance of RSACryptoServiceProvider that accesses
- // the key container identified by the containerName parameter.
- rsa = gcnew RSACryptoServiceProvider( cspParams );
-
- // Display the key information to the console.
- Console::WriteLine( "\nKey added to container: \n {0}", rsa->ToXmlString( true ) );
- }
-
- static void GetKeyFromContainer( String^ containerName )
- {
- try
- {
- cspParams = gcnew CspParameters;
- cspParams->KeyContainerName = containerName;
-
- // Create a new instance of RSACryptoServiceProvider that accesses
- // the key container identified by the containerName parameter.
- // If the key container does not exist, a new one is created.
- rsa = gcnew RSACryptoServiceProvider( cspParams );
-
- // Use the rsa object to access the key.
- // Display the key information to the console.
- Console::WriteLine( "\nKey retrieved from container : \n {0}", rsa->ToXmlString( true ) );
- Console::WriteLine( "KeycontainerName is {0}", rsa->CspKeyContainerInfo->KeyContainerName );
- Console::WriteLine( "ProviderName is {0}", rsa->CspKeyContainerInfo->ProviderName );
- Console::WriteLine( "ProviderType is {0}", (1 == rsa->CspKeyContainerInfo->ProviderType ? "PROV_RSA_FULL" : rsa->CspKeyContainerInfo->ProviderType.ToString()) );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception thrown: {0}", e->Message );
- }
-
- }
-
- static void DeleteKeyContainer( String^ containerName )
- {
-
- // Create the CspParameters object and set the key container
- // name used to store the RSA key pair.
- cspParams = gcnew CspParameters;
- cspParams->KeyContainerName = containerName;
-
- // Create a new instance of RSACryptoServiceProvider that accesses
- // the key container.
- rsa = gcnew RSACryptoServiceProvider( cspParams );
-
- // Do not persist the key entry, effectively deleting the key.
- rsa->PersistKeyInCsp = false;
-
- // Call Clear to release the key container resources.
- rsa->Clear();
- Console::WriteLine( "\nKey container released." );
- }
-
- static void DenyOpen()
- {
- try
- {
-
- //
- // Create a KeyContainerPermission with the right to open the key container.
- KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open );
-
- //
- // Demonstrate the results of a deny for an open action.
- keyContainerPerm->Deny();
-
- // The next line causes an exception to be thrown when the infrastructure code attempts
- // to open the key container.
- CspKeyContainerInfo ^ info = gcnew CspKeyContainerInfo( cspParams );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Expected exception thrown: {0}", e->Message );
- }
-
-
- // Revert the deny.
- CodeAccessPermission::RevertDeny();
- }
-
- static void DeleteContainer()
- {
- try
- {
-
- // Create a KeyContainerPermission with the right to create a key container.
- KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Create );
-
- // Deny the ability to create a key container.
- // This deny is used to show the key container has been successfully deleted.
- keyContainerPerm->Deny();
-
- // Retrieve the key from the container.
- // This code executes successfully because the key container already exists.
- // The deny for permission to create a key container does not affect this method call.
- GetKeyFromContainer( "MyKeyContainer" );
-
- // Delete the key and the container.
- DeleteKeyContainer( "MyKeyContainer" );
-
- // Attempt to obtain the key from the deleted key container.
- // This time the method call results in an exception because of
- // an attempt to create a new key container.
- Console::WriteLine( "\nAttempt to create a new key container with create permission denied." );
- GetKeyFromContainer( "MyKeyContainer" );
- }
- catch ( CryptographicException^ e )
- {
- Console::WriteLine( "Expected exception thrown: {0}", e->Message );
- }
-
- }
-
-};
-
-int main()
-{
- return KeyContainerPermissionDemo::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp
deleted file mode 100644
index 953013ec45d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-#define debug 0
-
-//
-//#define debug
-// This custom permission is intended only for the purposes of illustration.
-// The following code shows how to create a custom permission that inherits
-// from CodeAccessPermission. The code implements all required overrides.
-// A wildcard character ('*') is implemented for the Name property.
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::IO;
-using namespace System::Security::Policy;
-using namespace System::Collections;
-using namespace System::Text;
-
-[assembly:System::Reflection::AssemblyKeyFile("Key.snk")];
-[assembly:System::Security::AllowPartiallyTrustedCallersAttribute];
-
-[Serializable]
-public ref class NameIdPermission: public CodeAccessPermission, public IUnrestrictedPermission
-{
-private:
- String^ m_Name;
- bool m_Unrestricted;
-
-public:
- NameIdPermission( String^ name )
- {
- m_Name = name;
- }
-
- NameIdPermission( PermissionState state )
- {
- if ( state == PermissionState::None )
- {
- m_Name = "";
- }
- else if ( state == PermissionState::Unrestricted )
- {
- throw gcnew ArgumentException( "Unrestricted state is not allowed for identity permissions." );
- }
- else
- {
- throw gcnew ArgumentException( "Invalid permission state." );
- }
- }
-
- property String^ Name
- {
- String^ get()
- {
- return m_Name;
- }
- void set( String^ value )
- {
- m_Name = value;
- }
- }
-
- //
-public:
- virtual IPermission^ Copy() override
- {
- String^ name = m_Name;
- return gcnew NameIdPermission( name );
- }
- //
-
- //
-public:
- virtual bool IsUnrestricted()
- {
- // Always false, unrestricted state is not allowed.
- return m_Unrestricted;
- }
- //
-
-private:
- bool VerifyType( IPermission^ target )
- {
- return dynamic_cast(target) != nullptr;
- }
-
- //
-public:
- virtual bool IsSubsetOf( IPermission^ target ) override
- {
-#if ( debug )
- Console::WriteLine( "************* Entering IsSubsetOf *********************" );
-#endif
-
- if ( target == nullptr )
- {
- Console::WriteLine( "IsSubsetOf: target == null" );
- return false;
- }
-
-#if ( debug )
- Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name );
- Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name );
-#endif
-
- try
- {
- NameIdPermission^ operand = dynamic_cast(target);
-
- // The following check for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if ( true == operand->m_Unrestricted )
- {
- return true;
- }
- else if ( true == this->m_Unrestricted )
- {
- return false;
- }
-
- if ( this->m_Name != nullptr )
- {
- if ( operand->m_Name == nullptr )
- {
- return false;
- }
- if ( this->m_Name->Equals( "" ) )
- {
- return true;
- }
- }
-
- if ( this->m_Name->Equals( operand->m_Name ) )
- {
- return true;
- }
- else
- {
- // Check for wild card character '*'.
- int i = operand->m_Name->LastIndexOf( "*" );
-
- if ( i > 0 )
- {
- String^ prefix = operand->m_Name->Substring( 0, i );
- if ( this->m_Name->StartsWith( prefix ) )
- {
- return true;
- }
- }
- }
- return false;
- }
- catch ( InvalidCastException^ )
- {
- throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) );
- }
- }
- //
-
- //
-public:
- virtual IPermission^ Intersect( IPermission^ target ) override
- {
- Console::WriteLine( "************* Entering Intersect *********************" );
- if ( target == nullptr )
- {
- return nullptr;
- }
-
-#if ( debug )
- Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name );
- Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name );
-#endif
-
- if ( !VerifyType( target ) )
- {
- throw gcnew ArgumentException( String::Format( "Argument is wrong type.", this->GetType()->FullName ) );
- }
-
- NameIdPermission^ operand = dynamic_cast(target);
-
- if ( operand->IsSubsetOf( this ) )
- {
- return operand->Copy();
- }
- else if ( this->IsSubsetOf( operand ) )
- {
- return this->Copy();
- }
- else
- {
- return nullptr;
- }
- }
- //
-
- //
-public:
- virtual IPermission^ Union( IPermission^ target ) override
- {
-#if ( debug )
- Console::WriteLine( "************* Entering Union *********************" );
-#endif
-
- if ( target == nullptr )
- {
- return this;
- }
-
-#if ( debug )
- Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name );
- Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name );
-#endif
-
- if ( !VerifyType( target ) )
- {
- throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) );
- }
-
- NameIdPermission^ operand = dynamic_cast(target);
-
- if ( operand->IsSubsetOf( this ) )
- {
- return this->Copy();
- }
- else if ( this->IsSubsetOf( operand ) )
- {
- return operand->Copy();
- }
- else
- {
- return nullptr;
- }
- }
- //
-
- //
-public:
- virtual void FromXml( SecurityElement^ e ) override
- {
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- String^ elUnrestricted = e->Attribute("Unrestricted");
- if ( nullptr != elUnrestricted )
- {
- m_Unrestricted = Boolean::Parse( elUnrestricted );
- return;
- }
-
- String^ elName = e->Attribute("Name");
- m_Name = elName == nullptr ? nullptr : elName;
- }
- //
-
- //
-public:
- virtual SecurityElement^ ToXml() override
- {
- // Use the SecurityElement class to encode the permission to XML.
- SecurityElement^ esd = gcnew SecurityElement( "IPermission" );
- String^ name = NameIdPermission::typeid->AssemblyQualifiedName;
- esd->AddAttribute( "class", name );
- esd->AddAttribute( "version", "1.0" );
-
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if ( m_Unrestricted )
- {
- esd->AddAttribute( "Unrestricted", true.ToString() );
- }
-
- if ( m_Name != nullptr )
- {
- esd->AddAttribute( "Name", m_Name );
- }
-
- return esd;
- }
- //
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp
deleted file mode 100644
index 603984a43af..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-//
-// To execute this sample you will need two certification files, MyCert1.cer and MyCert2.cer.
-// The certification files can be created using the Certification Creation Tool, MakeCert.exe,
-// which runs from the command line. Usage: MakeCert MyCert1.cer
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Cryptography::X509Certificates;
-using namespace System::IO;
-
-// Demonstrate all methods.
-void main()
-{
- Console::WriteLine("Welcome to the PublisherIdentityPermission CPP sample\n");
-
- array^publisherCertificate = gcnew array(2);
- PublisherIdentityPermission ^ publisherPerm1;
- PublisherIdentityPermission ^ publisherPerm2;
-
- // Initialize the PublisherIdentityPermissions for use in the sample
-//
- FileStream ^ fs1 = gcnew FileStream("MyCert1.cer", FileMode::Open);
- array^certSBytes1 = gcnew array((int)fs1->Length);
- fs1->Read(certSBytes1, 0, (int)fs1->Length);
- publisherCertificate[0] = gcnew X509Certificate(certSBytes1);
- fs1->Close();
-
- FileStream ^ fs2 = gcnew FileStream("MyCert2.cer", FileMode::Open);
- array^certSBytes2 = gcnew array((int)fs2->Length);
- fs2->Read(certSBytes2, 0, (int)fs2->Length);
- publisherCertificate[1] = gcnew X509Certificate(certSBytes2);
- fs2->Close();
-//
-
- publisherPerm1 = gcnew PublisherIdentityPermission(publisherCertificate[0]);
- publisherPerm2 = gcnew PublisherIdentityPermission(publisherCertificate[1]);
-
-//
- Console::WriteLine("\n******************** IsSubsetOf DEMO ********************\n");
- // IsSubsetOf determines whether the current permission is a subset of the specified permission.
- if (publisherPerm2->IsSubsetOf(publisherPerm1))
- Console::WriteLine(publisherPerm2->Certificate->Subject + " is a subset of " +
- publisherPerm1->Certificate->Subject);
- else
- Console::WriteLine(publisherPerm2->Certificate->Subject + " is not a subset of " +
- publisherPerm1->Certificate->Subject);
-//
-
-//
- Console::WriteLine("\n******************** Copy DEMO ********************\n");
- // Copy creates and returns an identical copy of the current permission.
-//
- // Create an empty PublisherIdentityPermission to serve as the target of the copy.
- publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None);
- publisherPerm2 = (PublisherIdentityPermission^)publisherPerm1->Copy();
- Console::WriteLine("Result of copy = " + publisherPerm2);
-//
-//
-
-
-//
- Console::WriteLine("\n******************** Union DEMO ********************\n");
- PublisherIdentityPermission ^ publisherPerm3 = (PublisherIdentityPermission ^)publisherPerm1->Union(publisherPerm2);
-
- if (publisherPerm3 == nullptr)
- Console::WriteLine("The union of " + publisherPerm1 + " and " +
- publisherPerm2->Certificate->Subject + " is null.");
- else
- Console::WriteLine("The union of " + publisherPerm1->Certificate->Subject + " and " +
- publisherPerm2->Certificate->Subject + " = " +
- publisherPerm3->Certificate->Subject);
-//
-
-
-//
- // Intersect creates and returns a new permission that is the intersection of the current
- // permission and the permission specified.
- Console::WriteLine("\n******************** Intersect DEMO ********************\n");
- publisherPerm3 = (PublisherIdentityPermission^)publisherPerm1->Intersect(publisherPerm2);
- if (publisherPerm3 != nullptr)
- Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject +
- " and " + publisherPerm2->Certificate->Subject + " = " +
- publisherPerm3->Certificate->Subject);
- else
- Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject + " and " +
- publisherPerm2->Certificate->Subject + " is null.");
- //
-
-
-//
-// ToXml creates an XML encoding of the permission and its current state;
-// FromXml reconstructs a permission with the specified state from the XML encoding.
- Console::WriteLine("\n******************** ToXml DEMO ********************\n");
- publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None);
- publisherPerm2->FromXml(publisherPerm1->ToXml());
- Console::WriteLine("Result of ToFromXml = " + publisherPerm2);
-//
-
- Console::WriteLine("Press Enter to return");
- Console::ReadLine();
-}
-
-/*
-Expected output:
-
-Welcome to the PublisherIdentityPermission CPP sample
-
-
-******************** IsSubsetOf DEMO ********************
-
-CN=Joe's-Software-Emporium is not a subset of CN=Joe's-Software-Emporium
-
-******************** Copy DEMO ********************
-
-Result of copy =
-
-
-******************** Union DEMO ********************
-
-The union of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium = CN=Joe'
-s-Software-Emporium
-
-******************** Intersect DEMO ********************
-
-The intersection of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium =
-CN=Joe's-Software-Emporium
-
-******************** ToXml DEMO ********************
-
-Result of ToFromXml =
-
-Press Enter to return
-*/
-
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp
deleted file mode 100644
index cfad634f423..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-
-//
-// This sample demonstrates the use of the SecurityPermissionAttribute.
-using namespace System;
-using namespace System::Security::Permissions;
-using namespace System::Security;
-class MyClass
-{
-public:
- static void PermissionDemo()
- {
- try
- {
- DenySecurityPermissions();
- DenyAllSecurityPermissions();
- DoNotDenySecurityPermissions();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( e->Message );
- }
-
- }
-
-
- // This method demonstrates the use of the SecurityPermissionAttribute to deny individual security permissions.
- //
- // Set the Assertion property.
- [SecurityPermissionAttribute(SecurityAction::Deny,Assertion=true)]
- //
- //
- // Set the ControlAppDomain property.
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlAppDomain=true)]
- //
- //
- // Set the ControlDomainPolicy property.
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlDomainPolicy=true)]
- //
- //
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlEvidence=true)]
- // Set the ControlEvidence property.
- //
- //
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlPolicy=true)]
- // Set the ControlPolicy property.
- //
- //
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlPrincipal=true)]
- // Set the ControlPrincipal property.
- //
- //
- // Set the ControlThread property.
- [SecurityPermissionAttribute(SecurityAction::Deny,ControlThread=true)]
- //
- //
- // Set the Execution property.
- [SecurityPermissionAttribute(SecurityAction::Deny,Execution=true)]
- //
- //
- // Set the Flags property.
- [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::NoFlags)]
- //
- //
- // Set the Infrastructure property.
- [SecurityPermissionAttribute(SecurityAction::Deny,Infrastructure=true)]
- //
- //
- // Set the RemotingConfiguration property.
- [SecurityPermissionAttribute(SecurityAction::Deny,RemotingConfiguration=true)]
- //
- //
- // Set the SerializationFormatter property.
- [SecurityPermissionAttribute(SecurityAction::Deny,SerializationFormatter=true)]
- //
- //
- // Set the SkipVerification property.
- [SecurityPermissionAttribute(SecurityAction::Deny,SkipVerification=true)]
- //
- //
- // Set the UnmanagedCode property.
- [SecurityPermissionAttribute(SecurityAction::Deny,UnmanagedCode=true)]
- //
-
- static void DenySecurityPermissions()
- {
- Console::WriteLine( "Executing DenySecurityPermissions." );
- Console::WriteLine( "Denied all permissions individually." );
- TestSecurityPermissions();
- }
-
-
- // This method demonstrates the use of SecurityPermissionFlag::AllFlags to deny all security permissions.
-
- [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::AllFlags)]
- static void DenyAllSecurityPermissions()
- {
- Console::WriteLine( "\nExecuting DenyAllSecurityPermissions." );
- Console::WriteLine( "Denied all permissions using SecurityPermissionFlag::AllFlags." );
- TestSecurityPermissions();
- }
-
-
- // This method demonstrates the effect of not denying security permissions.
- static void DoNotDenySecurityPermissions()
- {
- Console::WriteLine( "\nExecuting DoNotDenySecurityPermissions." );
- Console::WriteLine( "No permissions have been denied." );
- DemandSecurityPermissions();
- }
-
- static void TestSecurityPermissions()
- {
- Console::WriteLine( "\nExecuting TestSecurityPermissions.\n" );
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" );
-
- // This demand should cause an exception.
- sp->Demand();
-
- // The TestFailed method is called if an exception is not thrown.
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration );
- Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter );
- Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification );
- Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" );
- sp->Demand();
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode );
- Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" );
-
- // This demand should cause an exception.
- sp->Demand();
-
- // The TestFailed method is called if an exception is not thrown.
- TestFailed();
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message );
- }
-
- }
-
- static void TestFailed()
- {
- Console::WriteLine( "In TestFailed method." );
- Console::WriteLine( "Throwing an exception." );
- throw gcnew Exception;
- }
-
-//
- static void DemandSecurityPermissions()
- {
- Console::WriteLine( "\nExecuting DemandSecurityPermissions.\n" );
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread );
- Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::Execution succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure );
- Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration );
- Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter );
- Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification );
- Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message );
- }
-
- try
- {
- SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode );
- Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" );
- sp->Demand();
- Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode succeeded." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message );
- }
-
- }
-//
-
-};
-
-int main()
-{
- MyClass::PermissionDemo();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp
deleted file mode 100644
index 1cf6f037e02..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::Security::Permissions;
-using namespace System::Security::Cryptography;
-using namespace System::Security::Cryptography::X509Certificates;
-using namespace System::Security;
-using namespace System::IO;
-
-[assembly:StorePermissionAttribute(SecurityAction::RequestMinimum,
-Flags=StorePermissionFlags::DeleteStore)];
-void AddToStore( X509Certificate2 ^ cert );
-void ShowMembers();
-int main()
-{
-
- //
- Console::WriteLine( "Creating a permission with Flags = OpenStore." );
- StorePermission^ sp = gcnew StorePermission( StorePermissionFlags::OpenStore );
-
- //
- //Create a new X509 store named teststore from the local certificate store.
- //You must put in a valid path to a certificate in the following constructor.
- X509Certificate2^ certificate = gcnew X509Certificate2( "c:\\certificates\\*****.cer" );
-
- // Deny the permission to open a store.
- sp->Deny();
-
- // The following code results in an exception due to an attempt to open a store.
- AddToStore( certificate );
-
- // Remove the deny for opening a store.
- CodeAccessPermission::RevertDeny();
-
- // The following code results in an exception due to an attempt to add a certificate.
- // The exception is thrown due to a StorePermissionAttribute on the method denying AddToStore permission.
- AddToStore( certificate );
-
- // The current code is not affected by the attribute in the previously called method, so the following
- // intructions execute without an exception.
- X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser );
- store->Open( OpenFlags::ReadWrite );
- store->Add( certificate );
-
- // Demonstrate the behavior of the class members.
- ShowMembers();
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadKey();
-}
-
-
-//
-//Deny the permission the ability to add to a store.
-
-[StorePermission(SecurityAction::Deny,Flags=StorePermissionFlags::AddToStore)]
-void AddToStore( X509Certificate2^ cert )
-{
- try
- {
- X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser );
- store->Open( OpenFlags::ReadWrite );
-
- // The following attempt to add a certificate results in an exception being thrown.
- store->Add( cert );
- return;
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "Security exception thrown when attempting: {0}",
- (dynamic_cast(e->FirstPermissionThatFailed))->Flags );
- return;
- }
-
-}
-
-
-//
-// The following function is intended to demonstrate only the behavior of
-// StorePermission class members,and not their practical usage. Most properties
-// and methods in this class are used for the resolution and enforcement of
-// security policy by the security infrastructure code.
-void ShowMembers()
-{
- Console::WriteLine( "Creating first permission with Flags = OpenStore." );
- StorePermission^ sp1 = gcnew StorePermission( StorePermissionFlags::OpenStore );
- Console::WriteLine( "Creating second permission with Flags = AllFlags." );
- StorePermission^ sp2 = gcnew StorePermission( StorePermissionFlags::AllFlags );
- Console::WriteLine( "Creating third permission as Unrestricted." );
-
- //
- StorePermission^ sp3 = gcnew StorePermission( PermissionState::Unrestricted );
-
- //
- Console::WriteLine( "Creating fourth permission with a permission state of none." );
- StorePermission^ sp4 = gcnew StorePermission( PermissionState::None );
-
- //
- bool rc = sp2->IsSubsetOf( sp3 );
- Console::WriteLine( "Is the permission with complete store access (AllFlags) a subset of \n"
- "\tthe permission with an Unrestricted permission state? {0}", (rc ? (String^)"Yes" : "No") );
- rc = sp1->IsSubsetOf( sp2 );
- Console::WriteLine( "Is the permission with OpenStore access a subset of the permission with \n"
- "\tcomplete store access (AllFlags)? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- rc = sp3->IsUnrestricted();
- Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- Console::WriteLine( "Copying the second permission to the fourth permission." );
- sp4 = dynamic_cast(sp2->Copy());
- rc = sp4->Equals( sp2 );
- Console::WriteLine( "Is the fourth permission equal to the second permission? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
- //
- Console::WriteLine( "Creating the intersection of the second and first permissions." );
- sp4 = dynamic_cast(sp2->Intersect( sp1 ));
- Console::WriteLine( "Value of the Flags property is: {0}", sp4->Flags );
-
- //
- //
- Console::WriteLine( "Creating the union of the second and first permissions." );
- sp4 = dynamic_cast(sp2->Union( sp1 ));
- Console::WriteLine( "Result of the union of the second permission with the first: {0}", sp4->Flags );
-
- //
- //
- Console::WriteLine( "Using an XML roundtrip to reset the fourth permission." );
- sp4->FromXml( sp2->ToXml() );
- rc = sp4->Equals( sp2 );
- Console::WriteLine( "Does the XML roundtrip result equal the original permission? {0}", (rc ? (String^)"Yes" : "No") );
-
- //
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp
deleted file mode 100644
index 6fbc207a89a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Runtime::InteropServices;
-
-// This class generates StrongNameIdentityPermission objects.
-
-[assembly:CLSCompliant(true)];
-
-public ref class StrongNameIdentityDemo
-{
-private:
- // Public key
- static array^b1 = {0,36,0,0,4,128,0,0,148,0,0,0,6,2,0,0,0,36,0,0,82,83,65,49,0,4,0,0,1,0,1,0,237,146,145,51,34,97,123,196,90,174,41,170,173,221,41,193,175,39,7,151,178,0,230,152,218,8,206,206,170,84,111,145,26,208,158,240,246,219,228,34,31,163,11,130,16,199,111,224,4,112,46,84,0,104,229,38,39,63,53,189,0,157,32,38,34,109,0,171,114,244,34,59,9,232,150,192,247,175,104,143,171,42,219,66,66,194,191,218,121,59,92,42,37,158,13,108,210,189,9,203,204,32,48,91,212,101,193,19,227,107,25,133,70,2,220,83,206,71,102,245,104,252,87,109,190,56,34,180};
- static StrongNamePublicKeyBlob^ blob = gcnew StrongNamePublicKeyBlob( b1 );
-
- // Use this version number.
- static Version^ v1 = gcnew Version( "1.0.0.0" );
-
- //
- // IsSubsetOf determines whether the current permission is a subset of the specified permission.
- bool IsSubsetOfDemo()
- {
- bool returnValue = true;
-
- StrongNameIdentityPermission^ snIdPerm1;
- StrongNameIdentityPermission^ snIdPerm2;
-
- //
- snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0"));
- //
- snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0"));
-
- if (snIdPerm1->IsSubsetOf(snIdPerm2))
- {
-
- Console::WriteLine("MyCompany.MyDepartment.* is a subset " +
- "of MyCompany.MyDepartment.MyFile \n");
- }
- else
- {
- Console::WriteLine("MyCompany.MyDepartment.*" +
- " is not a subset of MyCompany.MyDepartment.MyFile \n");
- }
-
- return returnValue;
- }
-
-
- //
- //
- // Union creates a new permission that is the union of the current permission and the specified permission.
- bool UnionDemo()
- {
- bool returnValue = true;
- StrongNameIdentityPermission^ snIdPerm1;
- StrongNameIdentityPermission^ snIdPerm2;
- IPermission^ snIdPerm3;
- snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0"));
- snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0"));
- snIdPerm3 = dynamic_cast(snIdPerm1->Union( snIdPerm2 ));
- snIdPerm3 = snIdPerm1->Union( snIdPerm2 );
-
- try
- {
- Console::WriteLine("The union of MyCompany.MyDepartment.*" +
- "and MyCompany.MyDepartment.MyFile is " +
- (dynamic_cast(snIdPerm3))->Name);
- }
- catch (Exception^ e)
- {
- Console::WriteLine("An expected exception was thrown: " + e->Message);
- }
-
-
- return returnValue;
- }
-
-
- //
- //
- // Intersect creates and returns a new permission that is the intersection of the current
- // permission and the permission specified.
- bool IntersectDemo()
- {
- bool returnValue = true;
- StrongNameIdentityPermission^ snIdPerm1;
- StrongNameIdentityPermission^ snIdPerm2;
- StrongNameIdentityPermission^ snIdPerm3;
- snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0"));
- snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0"));
-
- try
- {
-
- snIdPerm3 = dynamic_cast(snIdPerm1->Intersect(snIdPerm2));
-
- Console::WriteLine("The intersection of MyCompany.MyDepartment.*" +
- "and MyCompany.MyDepartment.MyFile is " +
- (dynamic_cast(snIdPerm3))->Name);
- }
- catch (Exception^ e)
- {
- Console::WriteLine("An exception was thrown: " + e);
- returnValue = false;
- }
-
- return returnValue;
-
- }
-
-
- //
- //
- //Copy creates and returns an identical copy of the current permission.
- bool CopyDemo()
- {
- bool returnValue = true;
- StrongNameIdentityPermission^ snIdPerm1;
- StrongNameIdentityPermission^ snIdPerm2;
- snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0"));
- //
- snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None);
- //
-
- snIdPerm2 = dynamic_cast(snIdPerm1->Copy());
- Console::WriteLine("Result of copy = " + snIdPerm2->ToString() + "\n");
-
- return returnValue;
- }
-
-
- //
- //
- // ToXml creates an XML encoding of the permission and its current state;
- //FromXml reconstructs a permission with the specified state from the XML encoding.
- bool ToFromXmlDemo()
- {
- bool returnValue = true;
- StrongNameIdentityPermission^ snIdPerm1;
- StrongNameIdentityPermission^ snIdPerm2;
- snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0"));
- snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None);
- snIdPerm2->FromXml(snIdPerm1->ToXml());
- Console::WriteLine("Result of ToFromXml = " + snIdPerm2->ToString() + "\n");
-
- return returnValue;
- }
-
-
-public:
-
- //
- // Invoke all demos.
- bool RunDemo()
- {
- bool ret = true;
- bool retTmp;
-
- // Call the IsSubsetOf demo.
- if ( retTmp = IsSubsetOfDemo() )
- Console::WriteLine( "IsSubsetOf demo completed successfully." );
- else
- Console::WriteLine( "IsSubsetOf demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Union demo.
- if ( retTmp = UnionDemo() )
- Console::WriteLine( "Union demo completed successfully." );
- else
- Console::WriteLine( "Union demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Intersect demo.
- if ( retTmp = IntersectDemo() )
- Console::WriteLine( "Intersect demo completed successfully." );
- else
- Console::WriteLine( "Intersect demo failed." );
-
- ret = retTmp && ret;
-
- // Call the Copy demo.
- if ( retTmp = CopyDemo() )
- Console::WriteLine( "Copy demo completed successfully" );
- else
- Console::WriteLine( "Copy demo failed." );
-
- ret = retTmp && ret;
-
- // Call the ToFromXml demo.
- if ( retTmp = ToFromXmlDemo() )
- Console::WriteLine( "ToFromXml demo completed successfully" );
- else
- Console::WriteLine( "ToFromXml demo failed." );
-
- ret = retTmp && ret;
- Console::WriteLine( "********************************************************\n" );
- return (ret);
- }
-
-};
-
-
-// Test harness.
-int main()
-{
- try
- {
- StrongNameIdentityDemo^ democase = gcnew StrongNameIdentityDemo;
- bool ret = democase->RunDemo();
- if ( ret )
- {
- Console::WriteLine( "StrongNameIdentity demo completed successfully." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 100;
- }
- else
- {
- Console::WriteLine( "StrongNameIdentity demo failed." );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "StrongNameIdentity demo failed." );
- Console::WriteLine( e );
- Console::WriteLine( "Press the Enter key to exit." );
- Console::ReadLine();
- System::Environment::ExitCode = 101;
- }
-
-}
-
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp
deleted file mode 100644
index 2ff0e156c43..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-// UIPermCPP.cpp : main project file.
-
-
-
-//
-// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml and FromXml methods
-// of the UIPermission class.
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Runtime::InteropServices;
-
-void IsSubsetOfDemo(); // Forward references
-void CopyDemo();
-void UnionDemo();
-void IntersectDemo();
-void ToFromXmlDemo();
-
-
-int main()
-{
- IsSubsetOfDemo();
- CopyDemo();
- UnionDemo();
- IntersectDemo();
- ToFromXmlDemo();
-}
-
-
-
-//
-// IsSubsetOf determines whether the current permission is a subset of the specified permission.
-
-void IsSubsetOfDemo()
-{
- Console::WriteLine("\n********************** IsSubsetOf() Demo **********************\n");
-//
- UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows);
-//
- UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows);
-
- Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Window,
- uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Window);
-
- Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Window,
- uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Window);
-
-//
- uiPerm1 = gcnew UIPermission(UIPermissionClipboard::AllClipboard);
-//
- uiPerm2 = gcnew UIPermission(UIPermissionClipboard::OwnClipboard);
-
- Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Clipboard,
- uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Clipboard);
-
- Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Clipboard,
- uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Clipboard);
-}
-//
-
-
-
-//
- // Union creates a new permission that is the union of the current permission
- // and the specified permission.
-void UnionDemo()
-{
- Console::WriteLine("\n************************ Union() Demo *************************\n");
-
- UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows);
- UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows);
-
- UIPermission ^ p3 = dynamic_cast(uiPerm1->Union(uiPerm2));
- Console::WriteLine(" The union of {0} and \n\t{1} = {2} ", uiPerm1->Window,
- uiPerm2->Window, (nullptr != p3)?p3->Window.ToString():"null");
-}
-//
-
-//
-// Intersect creates and returns a new permission that is the intersection of the
-// current permission and the permission specified.
-void IntersectDemo()
-{
- Console::WriteLine("\n********************** Intersect() Demo ***********************\n");
-//
- UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows,UIPermissionClipboard::OwnClipboard);
-//
- UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows,UIPermissionClipboard::NoClipboard);
- UIPermission ^ p3 = (UIPermission^)uiPerm1->Intersect(uiPerm2);
-
- Console::WriteLine(" The intersection of {0} and \n\t{1} = {2} ", uiPerm1->Window,
- uiPerm1->Window, (nullptr != p3)?p3->Window.ToString():"null");
-
- Console::WriteLine(" The intersection of " + uiPerm1->Clipboard.ToString() + " and \n\t" +
- uiPerm2->Clipboard.ToString() + " is " + p3->Clipboard.ToString());
-}
-//
-
-
-//
-//Copy creates and returns an identical copy of the current permission.
-void CopyDemo()
-{
- Console::WriteLine("\n************************* Copy() Demo *************************\n");
-
- UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows);
- //
- UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None);
- //
- uiPerm2 = (UIPermission ^)uiPerm1->Copy();
- if (uiPerm2 != nullptr)
- Console::WriteLine("The copy succeeded: " + uiPerm2->ToString());
-}
-//
-
-//
-
-// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
-// permission with the specified state from the XML encoding.
-void ToFromXmlDemo()
-{
- Console::WriteLine("\n********************** To/From XML() Demo *********************\n");
-
- UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows);
- UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None);
- uiPerm2->FromXml(uiPerm1->ToXml());
- bool result = uiPerm2->Equals(uiPerm1);
- if (result)
- Console::WriteLine("Result of ToFromXml = " + uiPerm2->ToString());
- else
- {
- Console::WriteLine(uiPerm2->ToString());
- Console::WriteLine(uiPerm1->ToString());
- }
-}
-//
-//
-
-/*
-// This code example creates the following output:
-
-********************** IsSubsetOf() Demo **********************
-
- SafeTopLevelWindows is not a subset of SafeSubWindows
- SafeSubWindows is a subset of SafeTopLevelWindows
- AllClipboard is not a subset of OwnClipboard
- OwnClipboard is a subset of AllClipboard
-
-************************* Copy() Demo *************************
-
-The copy succeeded:
-
-
-************************ Union() Demo *************************
-
- The union of SafeTopLevelWindows and
- SafeSubWindows = SafeTopLevelWindows
-
-********************** Intersect() Demo ***********************
-
- The intersection of SafeTopLevelWindows and
- SafeTopLevelWindows = SafeSubWindows
- The intersection of OwnClipboard and
- NoClipboard is NoClipboard
-
-********************** To/From XML() Demo *********************
-
-Result of ToFromXml =
-
-*/
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp
deleted file mode 100644
index ba4df789e20..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Runtime::InteropServices;
-
-void IsSubsetOfDemo(); // Forward references
-void CopyDemo();
-void IntersectDemo();
-void ToFromXmlDemo();
-
-void main()
-{
- IsSubsetOfDemo();
- CopyDemo();
- IntersectDemo();
- ToFromXmlDemo();
-
- Console::WriteLine("\n\nPress ENTER to return");
- Console::ReadLine();
-}
-
-//
-// IsSubsetOf determines whether the current permission is a subset of the specified permission.
-void IsSubsetOfDemo()
-{
- //
- UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/");
- //
- UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*");
-
- if (permIdPerm1->IsSubsetOf(permIdPerm2))
- Console::WriteLine(permIdPerm1->Url + " is a subset of " + permIdPerm2->Url);
- else Console::WriteLine(permIdPerm1->Url + " is not a subset of " + permIdPerm2->Url);
- if (permIdPerm2->IsSubsetOf(permIdPerm1))
- Console::WriteLine(permIdPerm2->Url + " is a subset of " + permIdPerm1->Url);
- else Console::WriteLine(permIdPerm2->Url + " is not a subset of " + permIdPerm1->Url);
-}
-//
-
-//
-// Intersect creates and returns a gcnew permission that is the intersection of the
-// current permission and the permission specified.
-void IntersectDemo()
-{
-
- UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/");
- UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*");
- UrlIdentityPermission ^ p3 = (UrlIdentityPermission^)permIdPerm1->Intersect(permIdPerm2);
-
- if (p3 != nullptr)
- Console::WriteLine("The intersection of " + permIdPerm1->Url + " and \n\t" +
- permIdPerm2->Url + " is " + p3->Url + "\n");
- else Console::WriteLine("The intersection of " + permIdPerm1->Url +
- " and \n\t" + permIdPerm2->Url + " is null.\n");
-}
-//
-
-//
-//Copy creates and returns an identical copy of the current permission.
-void CopyDemo()
-{
- UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*");
- //
- UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None);
- //
- permIdPerm2 = (UrlIdentityPermission^)permIdPerm1->Copy();
- if (permIdPerm2)
- Console::WriteLine("The copy succeeded: " + permIdPerm2->ToString() + " \n");
-}
-//
-
-//
-// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
-// permission with the specified state from the XML encoding.
-void ToFromXmlDemo()
-{
- UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*");
- UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None);
- permIdPerm2->FromXml(permIdPerm1->ToXml());
- bool result = permIdPerm2->Equals(permIdPerm1);
- if (result)
- Console::WriteLine("Result of ToFromXml = " + permIdPerm2->ToString());
- else
- {
- Console::WriteLine(permIdPerm2->ToString());
- Console::WriteLine(permIdPerm1->ToString());
- }
-
-}
-//
-
-
-
-//
-// This code example creates the following output:
-
-//http://www.fourthcoffee.com/process/ is a subset of http://www.fourthcoffee.com/
-//*
-//http://www.fourthcoffee.com/* is not a subset of http://www.fourthcoffee.com/pro
-//cess/
-//The copy succeeded:
-
-
-//The union of http://www.fourthcoffee.com/process/ and
-// http://www.fourthcoffee.com/* failed.
-//The operation is ambiguous because the permission represents multiple identities
-//.
-//The intersection of http://www.fourthcoffee.com/process/ and
-// http://www.fourthcoffee.com/* is http://www.fourthcoffee.com/process/
-
-//Result of ToFromXml =
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp
deleted file mode 100644
index 6c337fe9923..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-// This sample demonstrates how to use each member of the FileCodeGroup class.
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Policy;
-using namespace System::Security::Permissions;
-using namespace System::Reflection;
-
-ref class Members
-{
-public:
- [STAThread]
- static void Main()
- {
- FileCodeGroup^ fileCodeGroup = constructDefaultGroup();
-
- // Create a deep copy of the FileCodeGroup.
- //
- FileCodeGroup^ copyCodeGroup =
- dynamic_cast(fileCodeGroup->Copy());
- //
-
- CompareTwoCodeGroups( fileCodeGroup, copyCodeGroup );
- addPolicy( &fileCodeGroup );
- addXmlMember( &fileCodeGroup );
- updateMembershipCondition( &fileCodeGroup );
- addChildCodeGroup( &fileCodeGroup );
- Console::Write( L"Comparing the resolved code group " );
- Console::WriteLine( L"with the initial code group." );
- FileCodeGroup^ resolvedCodeGroup =
- ResolveGroupToEvidence( fileCodeGroup );
- if ( CompareTwoCodeGroups( fileCodeGroup, resolvedCodeGroup ) )
- {
- PrintCodeGroup( resolvedCodeGroup );
- }
- else
- {
- PrintCodeGroup( fileCodeGroup );
- }
-
- Console::WriteLine( L"This sample completed successfully; press Enter to exit." );
- Console::ReadLine();
- }
-
-private:
- // Construct a new FileCodeGroup with Read, Write, Append
- // and PathDiscovery access.
- static FileCodeGroup^ constructDefaultGroup()
- {
- // Construct a new file code group that has complete access to
- // files in the specified path.
- //
- FileCodeGroup^ fileCodeGroup = gcnew FileCodeGroup(
- gcnew AllMembershipCondition,FileIOPermissionAccess::AllAccess );
- //
-
- // Set the name of the file code group.
- //
- fileCodeGroup->Name = L"TempCodeGroup";
- //
-
- // Set the description of the file code group.
- //
- fileCodeGroup->Description = L"Temp folder permissions group";
- //
-
- // Retrieve the string representation of the fileCodeGroup�s
- // attributes. FileCodeGroup does not use AttributeString, so the
- // value should be null.
- //
- if ( fileCodeGroup->AttributeString != nullptr )
- {
- throw gcnew NullReferenceException(
- L"The AttributeString property should be null." );
- }
- //
-
- return fileCodeGroup;
- }
-
- // Add file permission to restrict write access to all files on the
- // local machine.
- static void addPolicy( interior_ptr fileCodeGroup )
- {
- // Set the PolicyStatement property to a policy with read access to
- // the root directory of drive C.
- //
- FileIOPermission^ rootFilePermissions =
- gcnew FileIOPermission( PermissionState::None );
- rootFilePermissions->AllLocalFiles =
- FileIOPermissionAccess::Read;
- rootFilePermissions->SetPathList(
- FileIOPermissionAccess::Read, L"C:\\" );
- NamedPermissionSet^ namedPermissions =
- gcnew NamedPermissionSet( L"RootPermissions" );
- namedPermissions->AddPermission( rootFilePermissions );
- ( *fileCodeGroup )->PolicyStatement =
- gcnew PolicyStatement( namedPermissions );
- //
- }
-
- // Set the membership condition of the specified FileCodeGroup
- // to the Intranet zone.
- static void updateMembershipCondition( interior_ptr fileCodeGroup )
- {
- //
- ZoneMembershipCondition^ zoneCondition =
- gcnew ZoneMembershipCondition( SecurityZone::Intranet );
- ( *fileCodeGroup )->MembershipCondition = zoneCondition;
- //
- }
-
- // Add a child group with read-access file permission to the specified
- // code group.
- static void addChildCodeGroup( interior_ptr fileCodeGroup )
- {
- // Create a file code group with read-access permission.
- //
- FileCodeGroup^ tempFolderCodeGroup = gcnew FileCodeGroup(
- gcnew AllMembershipCondition,FileIOPermissionAccess::Read );
-
- // Set the name of the child code group and add it to
- // the specified code group.
- tempFolderCodeGroup->Name = L"Read-only group";
- ( *fileCodeGroup )->AddChild( tempFolderCodeGroup );
- //
- }
-
- // Compare the two specified file code groups for equality.
- static bool CompareTwoCodeGroups( FileCodeGroup^ firstCodeGroup,
- FileCodeGroup^ secondCodeGroup )
- {
- //
- if ( firstCodeGroup->Equals( secondCodeGroup ) )
- //
- {
- Console::WriteLine( L"The two code groups are equal." );
- return true;
- }
- else
- {
- Console::WriteLine( L"The two code groups are not equal." );
- return false;
- }
- }
-
- // Retrieve the resolved policy based on Evidence from the executing
- // assembly found in the specified code group.
- static String^ ResolveEvidence( CodeGroup^ fileCodeGroup )
- {
- String^ policyString = L"";
-
- // Resolve the policy based on evidence in the executing assembly.
- //
- Assembly^ assembly = Members::typeid->Assembly;
- Evidence^ executingEvidence = assembly->Evidence;
- PolicyStatement^ policy = fileCodeGroup->Resolve( executingEvidence );
- //
-
- if ( policy != nullptr )
- {
- policyString = policy->ToString();
- }
-
- return policyString;
- }
-
- // Retrieve the resolved code group based on the Evidence from
- // the executing assembly found in the specified code group.
- static FileCodeGroup^ ResolveGroupToEvidence( FileCodeGroup^ fileCodeGroup )
- {
- // Resolve matching code groups to the executing assembly.
- //
- Assembly^ assembly = Members::typeid->Assembly;
- Evidence^ evidence = assembly->Evidence;
- CodeGroup^ codeGroup = fileCodeGroup->ResolveMatchingCodeGroups( evidence );
- //
-
- return dynamic_cast(codeGroup);
- }
-
- // If a domain attribute is not found in the specified FileCodeGroup,
- // add a child XML element identifying a custom membership condition.
- static void addXmlMember( interior_ptr fileCodeGroup )
- {
- //
- SecurityElement^ xmlElement = ( *fileCodeGroup )->ToXml();
- //
-
- SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" );
- if ( xmlElement->Attribute(L"domain") == nullptr )
- {
- //
- SecurityElement^ newElement = gcnew SecurityElement(
- L"CustomMembershipCondition" );
- newElement->AddAttribute( L"class", L"CustomMembershipCondition" );
- newElement->AddAttribute( L"version", L"1" );
- newElement->AddAttribute( L"domain", L"contoso.com" );
- rootElement->AddChild( newElement );
- ( *fileCodeGroup )->FromXml( rootElement );
- //
- }
-
- Console::WriteLine( L"Added a custom membership condition:" );
- Console::WriteLine( rootElement );
- }
-
- // Print the properties of the specified code group to the console.
- static void PrintCodeGroup( CodeGroup^ codeGroup )
- {
- // Compare the type of the specified object with the FileCodeGroup
- // type.
- //
- if ( !codeGroup->GetType()->Equals( FileCodeGroup::typeid ) )
- //
- {
- throw gcnew ArgumentException( L"Expected the FileCodeGroup type." );
- }
-
- String^ codeGroupName = codeGroup->Name;
- String^ membershipCondition = codeGroup->MembershipCondition->ToString();
-
- //
- String^ permissionSetName = codeGroup->PermissionSetName;
- //
-
- //
- int hashCode = codeGroup->GetHashCode();
- //
-
- String^ mergeLogic = L"";
-
- //
- if ( codeGroup->MergeLogic->Equals( L"Union" ) )
- {
- mergeLogic = L" with Union merge logic";
- }
- //
-
- // Retrieve the class path for FileCodeGroup.
- //
- String^ fileGroupClass = codeGroup->ToString();
-
- //
- // Write summary to the console window.
- Console::WriteLine( L"\n*** {0} summary ***", fileGroupClass );
- Console::Write( L"A FileCodeGroup named " );
- Console::Write( L"{0}{1}", codeGroupName, mergeLogic );
- Console::Write( L" has been created with hash code{0}.", hashCode );
- Console::Write( L"This code group contains a {0}", membershipCondition );
- Console::Write( L" membership condition with the " );
- Console::Write( L"{0} permission set. ", permissionSetName );
- Console::Write( L"The code group has the following security policy: " );
- Console::WriteLine( ResolveEvidence( codeGroup ) );
- int childCount = codeGroup->Children->Count;
- if ( childCount > 0 )
- {
- Console::Write( L"There are {0}", childCount );
- Console::WriteLine( L" child code groups in this code group." );
-
- // Iterate through the child code groups to display their names
- // and remove them from the specified code group.
- for ( int i = 0; i < childCount; i++ )
- {
- // Get child code group as type FileCodeGroup.
- //
- FileCodeGroup^ childCodeGroup =
- dynamic_cast(codeGroup->Children->default[ i ]);
-
- //
- Console::Write( L"Removing the {0}.", childCodeGroup->Name );
- // Remove child code group.
-
- //
- codeGroup->RemoveChild( childCodeGroup );
- //
- }
- Console::WriteLine();
- }
- else
- {
- Console::Write( L"There are no child code groups" );
- Console::WriteLine( L" in this code group." );
- }
- }
-};
-
-int main()
-{
- Members::Main();
-}
-
-//
-// This sample produces the following output:
-//
-// The two code groups are equal.
-// Added a custom membership condition:
-//
-//
-//
-// Comparing the resolved code group with the initial code group.
-// The two code groups are not equal.
-//
-// *** System.Security.Policy.FileCodeGroup summary ***
-// A FileCodeGroup named with Union merge logic has been created with hash
-// code 113151473. This code group contains a Zone - Intranet membership
-// condition with the Same directory FileIO - NoAccess permission set. The
-// code group has the following security policy:
-// There are 1 child code groups in this code group.
-// Removing the Read-only group.
-// This sample completed successfully; press Enter to exit.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp
deleted file mode 100644
index e8c9be6b48e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-// This sample demonstrates how to use each member of the FirstMatchCodeGroup
-// class.
-//
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Policy;
-using namespace System::Security::Permissions;
-using namespace System::Reflection;
-
-ref class Members
-{
-public:
- [STAThread]
- static void Main()
- {
- // Create a new FirstMatchCodeGroup.
- FirstMatchCodeGroup^ codeGroup = constructDefaultGroup();
-
- // Create a deep copy of the FirstMatchCodeGroup.
- //
- FirstMatchCodeGroup^ copyCodeGroup =
- dynamic_cast(codeGroup->Copy());
- //
-
- // Compare the original code group with the copy.
- CompareTwoCodeGroups( codeGroup, copyCodeGroup );
-
- addPolicy( &codeGroup );
- addXmlMember( &codeGroup );
- updateMembershipCondition( &codeGroup );
- addChildCodeGroup( &codeGroup );
-
- Console::Write( L"Comparing the resolved code group " );
- Console::WriteLine( L"with the initial code group." );
- FirstMatchCodeGroup^ resolvedCodeGroup =
- ResolveGroupToEvidence( codeGroup );
- if ( CompareTwoCodeGroups( codeGroup, resolvedCodeGroup ) )
- {
- PrintCodeGroup( resolvedCodeGroup );
- }
- else
- {
- PrintCodeGroup( codeGroup );
- }
-
- Console::WriteLine( L"This sample completed successfully; "
- L"press Enter to exit." );
- Console::ReadLine();
- }
-
-private:
- // Create a FirstMatchCodeGroup with an exclusive policy and membership
- // condition.
- static FirstMatchCodeGroup^ constructDefaultGroup()
- {
- // Construct a new FirstMatchCodeGroup with Read, Write, Append
- // and PathDiscovery access.
- // Create read access permission to the root directory on drive C.
- //
- FileIOPermission^ rootFilePermissions =
- gcnew FileIOPermission( PermissionState::None );
- rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read;
- rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" );
-
- // Add a permission to a named permission set.
- NamedPermissionSet^ namedPermissions =
- gcnew NamedPermissionSet( L"RootPermissions" );
- namedPermissions->AddPermission( rootFilePermissions );
-
- // Create a PolicyStatement with exclusive rights to the policy.
- PolicyStatement^ policy = gcnew PolicyStatement(
- namedPermissions,PolicyStatementAttribute::Exclusive );
-
- // Create a FirstMatchCodeGroup with a membership condition that
- // matches all code, and an exclusive policy.
- FirstMatchCodeGroup^ codeGroup = gcnew FirstMatchCodeGroup(
- gcnew AllMembershipCondition,policy );
- //
-
- // Set the name of the first match code group.
- //
- codeGroup->Name = L"TempCodeGroup";
- //
-
- // Set the description of the first match code group.
- //
- codeGroup->Description = L"Temp folder permissions group";
- //
- return codeGroup;
- }
-
- // Add file permission to restrict write access to all files
- // on the local machine.
- static void addPolicy( interior_ptr codeGroup )
- {
- // Set the PolicyStatement property to a policy with read access to
- // the root directory on drive C.
- //
- FileIOPermission^ rootFilePermissions =
- gcnew FileIOPermission( PermissionState::None );
- rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read;
- rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" );
-
- NamedPermissionSet^ namedPermissions =
- gcnew NamedPermissionSet( L"RootPermissions" );
- namedPermissions->AddPermission( rootFilePermissions );
-
- // Create a PolicyStatement with exclusive rights to the policy.
- PolicyStatement^ policy = gcnew PolicyStatement(
- namedPermissions,PolicyStatementAttribute::Exclusive );
- ( *codeGroup )->PolicyStatement = policy;
- //
- }
-
- // Set the membership condition of the code group.
- static void updateMembershipCondition(
- interior_ptr codeGroup )
- {
- // Set the membership condition of the specified FirstMatchCodeGroup
- // to the Intranet zone.
- //
- ZoneMembershipCondition^ zoneCondition =
- gcnew ZoneMembershipCondition( SecurityZone::Intranet );
- ( *codeGroup )->MembershipCondition = zoneCondition;
- //
- }
-
- // Create a child code group with read-access file permissions and add it
- // to the specified code group.
- static void addChildCodeGroup( interior_ptr codeGroup )
- {
- // Create a first match code group with read access.
- //
- FileIOPermission^ rootFilePermissions = gcnew FileIOPermission(
- PermissionState::None );
- rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read;
- rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" );
-
- PermissionSet^ permissions = gcnew PermissionSet(
- PermissionState::Unrestricted );
- permissions->AddPermission( rootFilePermissions );
-
- FirstMatchCodeGroup^ tempFolderCodeGroup =
- gcnew FirstMatchCodeGroup( gcnew AllMembershipCondition,
- gcnew PolicyStatement( permissions ) );
-
- // Set the name of the child code group and add it to
- // the specified code group.
- tempFolderCodeGroup->Name = L"Read-only code group";
- ( *codeGroup )->AddChild( tempFolderCodeGroup );
- //
- }
-
- // Compare the two FirstMatchCodeGroups.
- static bool CompareTwoCodeGroups( FirstMatchCodeGroup^ firstCodeGroup,
- FirstMatchCodeGroup^ secondCodeGroup )
- {
- // Compare the two specified FirstMatchCodeGroups for equality.
- //
- if ( firstCodeGroup->Equals( secondCodeGroup ) )
- //
- {
- Console::WriteLine( L"The two code groups are equal." );
- return true;
- }
- else
- {
- Console::WriteLine( L"The two code groups are not equal." );
- return false;
- }
- }
-
- // Retrieve the resolved policy based on executing evidence found
- // in the specified code group.
- static String^ ResolveEvidence( CodeGroup^ codeGroup )
- {
- String^ policyString = L"None";
-
- // Resolve the policy based on the executing assembly's evidence.
- //
- Assembly^ assembly = Members::typeid->Assembly;
- Evidence^ executingEvidence = assembly->Evidence;
-
- PolicyStatement^ policy = codeGroup->Resolve( executingEvidence );
- //
-
- if ( policy != nullptr )
- {
- policyString = policy->ToString();
- }
-
- return policyString;
- }
-
- // Retrieve the resolved code group based on the evidence from the
- // specified code group.
- static FirstMatchCodeGroup^ ResolveGroupToEvidence(
- FirstMatchCodeGroup^ codeGroup )
- {
- // Resolve matching code groups to the executing assembly.
- //
- Assembly^ assembly = Members::typeid->Assembly;
- Evidence^ evidence = assembly->Evidence;
- CodeGroup^ resolvedCodeGroup =
- codeGroup->ResolveMatchingCodeGroups( evidence );
- //
-
- return dynamic_cast(resolvedCodeGroup);
- }
-
- // If a domain attribute is not found in the specified
- // FirstMatchCodeGroup, add a child XML element identifying a custom
- // membership condition.
- static void addXmlMember( interior_ptr codeGroup )
- {
- //
- SecurityElement^ xmlElement = ( *codeGroup )->ToXml();
- //
-
- SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" );
-
- if ( xmlElement->Attribute(L"domain") == nullptr )
- {
- //
- SecurityElement^ newElement = gcnew SecurityElement(
- L"CustomMembershipCondition" );
- newElement->AddAttribute( L"class", L"CustomMembershipCondition" );
- newElement->AddAttribute( L"version", L"1" );
- newElement->AddAttribute( L"domain", L"contoso.com" );
- rootElement->AddChild( newElement );
- ( *codeGroup )->FromXml( rootElement );
- //
- }
-
- Console::WriteLine( L"Added a custom membership condition:" );
- Console::WriteLine( rootElement );
- }
-
- // Print the properties of the specified code group to the console.
- static void PrintCodeGroup( CodeGroup^ codeGroup )
- {
- // Compare the type of the specified object with the
- // FirstMatchCodeGroup type.
- //
- if ( !codeGroup->GetType()->Equals( FirstMatchCodeGroup::typeid ) )
- //
- {
- throw gcnew ArgumentException( L"Expected the FirstMatchCodeGroup type." );
- }
-
- String^ codeGroupName = codeGroup->Name;
- String^ membershipCondition = codeGroup->MembershipCondition->ToString();
-
- //
- String^ permissionSetName = codeGroup->PermissionSetName;
- //
-
- //
- int hashCode = codeGroup->GetHashCode();
- //
-
- String^ mergeLogic = L"";
- //
- if ( codeGroup->MergeLogic->Equals( L"First Match" ) )
- //
- {
- mergeLogic = L"with first-match merge logic";
- }
-
- // Retrieve the class path for the FirstMatchCodeGroup.
- //
- String^ firstMatchGroupClass = codeGroup->ToString();
- //
-
- String^ attributeString = L"";
- // Retrieve the string representation of the FirstMatchCodeGroup's
- // attributes.
- //
- if ( codeGroup->AttributeString != nullptr )
- {
- attributeString = codeGroup->AttributeString;
- }
- //
-
- // Write a summary to the console window.
- Console::WriteLine( L"\n*** {0} summary ***", firstMatchGroupClass );
- Console::Write( L"A FirstMatchCodeGroup named " );
- Console::Write( L"{0}{1}", codeGroupName, mergeLogic );
- Console::Write( L" has been created with hash code({0}).", hashCode );
- Console::Write( L"\nThis code group contains a {0}", membershipCondition );
- Console::Write( L" membership condition with the " );
- Console::WriteLine( L"{0} permission set.", permissionSetName );
-
- Console::Write( L"The code group contains the following policy: " );
- Console::Write( ResolveEvidence( codeGroup ) );
- Console::Write( L"\nIt also contains the following attributes: " );
- Console::WriteLine( attributeString );
-
- int childCount = codeGroup->Children->Count;
- if ( childCount > 0 )
- {
- Console::Write( L"There are {0}", childCount );
- Console::WriteLine( L" child elements in the code group." );
-
- // Iterate through the child code groups to display their names
- // and then remove them from the specified code group.
- for ( int i = 0; i < childCount; i++ )
- {
- // Retrieve a child code group, which has been cast as a
- // FirstMatchCodeGroup type.
- //
- FirstMatchCodeGroup^ childCodeGroup =
- dynamic_cast(codeGroup->Children->default[ i ]);
- //
-
- Console::Write( L"Removing the {0}.", childCodeGroup->Name );
- // Remove the child code group.
- //
- codeGroup->RemoveChild( childCodeGroup );
- //
- }
- Console::WriteLine();
- }
- else
- {
- Console::WriteLine( L" No child code groups were found in this"
- L" code group." );
- }
- }
-};
-
-int main()
-{
- Members::Main();
-}
-//
-// This sample produces the following output:
-//
-// The two code groups are equal.
-// Added a custom membership condition:
-//
-//
-//
-//
-// Comparing the resolved code group with the initial code group.
-// The two code groups are not equal.
-//
-// *** System.Security.Policy.FirstMatchCodeGroup summary ***
-// A FirstMatchCodeGroup named with first-match merge logic has been created
-// with hash code(113151525).
-// This code group contains a Zone - Intranet membership condition with the
-// permission set. The code group contains the following policy:
-// It also contains the following attributes:
-// There are 1 child elements in the code group.
-// Removing the Read-only code group.
-// This sample completed successfully; press Enter to exit.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp
deleted file mode 100644
index 0e0dece2b02..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Security::Policy;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-
-[STAThread]
-int main()
-{
-
- //
- GacInstalled ^ myGacInstalled = gcnew GacInstalled;
- //
-
- //
- array
-
- //
- GacInstalled ^ myGacInstalledCopy =
- dynamic_cast(myGacInstalled->Copy());
- bool result = myGacInstalled->Equals( myGacInstalledCopy );
- //
-
- //
- Console::WriteLine( "Hashcode = {0}", myGacInstalled->GetHashCode() );
- //
-
- //
- Console::WriteLine( myGacInstalled->ToString() );
- //
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp
deleted file mode 100644
index bb909af8192..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Security::Policy;
-
-public ref class PrincipalPermTest
-{
-public:
- void Dummy1()
- {
- //
- PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator");
- PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator");
- IPermission^ pp1 = ppBob->Intersect(ppLouise);
- //
- }
-
- void Dummy2()
- {
- //
- IPermission^ pp1 = gcnew PrincipalPermission("", "Administrator");
- //
- }
-
- void Dummy3()
- {
- //
- PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator");
- PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator");
- //
- }
-};
-
-
-int main()
-{
-
-}
diff --git a/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermission.cs b/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermission.cs
deleted file mode 100644
index 0ced5a65dd6..00000000000
--- a/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermission.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-#define debug
-//#define debug
-// This custom permission is intended only for the purposes of illustration.
-// The following code shows how to create a custom permission that inherits
-// from CodeAccessPermission. The code implements all required overrides.
-// A wildcard character ('*') is implemented for the Name property.
-using System;
-using System.Security;
-using System.Security.Permissions;
-using System.IO;
-using System.Security.Policy;
-using System.Collections;
-using System.Text;
-// Use the command line option '/keyfile' or appropriate project settings to sign this assembly.
-[assembly:System.Security.AllowPartiallyTrustedCallersAttribute()]
-
-namespace MyPermission
-{
- [Serializable()] sealed public class NameIdPermission : CodeAccessPermission, IUnrestrictedPermission
- {
- private String m_Name;
- private bool m_Unrestricted;
-
- public NameIdPermission(String name)
- {
- m_Name = name;
- }
-
- public NameIdPermission(PermissionState state)
- {
- if (state == PermissionState.None)
- {
- m_Name = "";
- }
- else
- if (state == PermissionState.Unrestricted)
- {
- throw new ArgumentException("Unrestricted state is not allowed for identity permissions.");
- }
- else
- {
- throw new ArgumentException("Invalid permission state.");
- }
- }
-
- public String Name
- {
- set{m_Name = value;}
- get{ return m_Name;}
- }
- public override IPermission Copy()
- {
- string name = m_Name;
- return new NameIdPermission( name );
- }
-
- public bool IsUnrestricted()
- {
- // Always false, unrestricted state is not allowed.
- return m_Unrestricted;
- }
-
- private bool VerifyType(IPermission target)
- {
- return (target is NameIdPermission);
- }
-
- public override bool IsSubsetOf(IPermission target)
- {
-#if(debug)
- Console.WriteLine ("************* Entering IsSubsetOf *********************");
-#endif
- if (target == null)
- {
- Console.WriteLine ("IsSubsetOf: target == null");
- return false;
- }
-#if(debug)
-
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- try
- {
- NameIdPermission operand = ( NameIdPermission)target;
-
- // The following check for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if (true == operand.m_Unrestricted)
- {
- return true;
- }
- else if (true == this.m_Unrestricted)
- {
- return false;
- }
-
- if (this.m_Name != null)
- {
- if (operand.m_Name == null) return false;
-
- if (this.m_Name == "") return true;
- }
-
- if (this.m_Name.Equals (operand.m_Name))
- {
- return true;
- }
- else
- {
- // Check for wild card character '*'.
- int i = operand.m_Name.LastIndexOf ("*");
-
- if (i > 0)
- {
- string prefix = operand.m_Name.Substring (0, i);
-
- if (this.m_Name.StartsWith (prefix))
- {
- return true;
- }
- }
- }
-
- return false;
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException (String.Format ("Argument_WrongType", this.GetType ().FullName));
- }
- }
-
- public override IPermission Intersect(IPermission target)
- {
- Console.WriteLine ("************* Entering Intersect *********************");
- if (target == null)
- {
- return null;
- }
-#if(debug)
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- if (!VerifyType(target))
- {
- throw new ArgumentException (String.Format ("Argument is wrong type.", this.GetType ().FullName));
- }
-
- NameIdPermission operand = ( NameIdPermission)target;
-
- if (operand.IsSubsetOf (this)) return operand.Copy ();
- else if (this.IsSubsetOf (operand)) return this.Copy ();
- else
- return null;
- }
-
- public override IPermission Union(IPermission target)
- {
-#if(debug)
- Console.WriteLine ("************* Entering Union *********************");
-#endif
- if (target == null)
- {
- return this;
- }
-#if(debug)
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- if (!VerifyType(target))
- {
- throw new ArgumentException (String.Format ("Argument_WrongType", this.GetType ().FullName));
- }
-
- NameIdPermission operand = ( NameIdPermission)target;
-
- if (operand.IsSubsetOf (this)) return this.Copy ();
- else if (this.IsSubsetOf (operand)) return operand.Copy ();
- else
- return null;
- }
-
- public override void FromXml(SecurityElement e)
- {
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- String elUnrestricted = e.Attribute("Unrestricted");
- if (null != elUnrestricted)
- {
- m_Unrestricted = bool.Parse(elUnrestricted);
- return;
- }
-
- String elName = e.Attribute( "Name" );
- m_Name = elName == null ? null : elName;
- }
-
- public override SecurityElement ToXml()
- {
- // Use the SecurityElement class to encode the permission to XML.
- SecurityElement esd = new SecurityElement("IPermission");
- String name = typeof( NameIdPermission).AssemblyQualifiedName;
- esd.AddAttribute("class", name);
- esd.AddAttribute("version", "1.0");
-
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if (m_Unrestricted)
- {
- esd.AddAttribute("Unrestricted", true.ToString());
- }
- if (m_Name != null) esd.AddAttribute( "Name", m_Name );
- return esd;
- }
- }
-}
diff --git a/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermissionattribute.cs b/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermissionattribute.cs
deleted file mode 100644
index 73528122ef5..00000000000
--- a/snippets/csharp/System.Security.Permissions/CodeAccessSecurityAttribute/Overview/nameidpermissionattribute.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-using System;
-using System.IO;
-using System.Runtime.Remoting;
-using System.Security;
-using System.Security.Permissions;
-using System.Reflection;
-using MyPermission;
-// Use the command line option '/keyfile' or appropriate project settings to sign this assembly.
-[assembly: System.Security.AllowPartiallyTrustedCallersAttribute ()]
-
-namespace MyPermissionAttribute
-{
- [AttributeUsage (AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
- [Serializable]
- sealed public class NameIdPermissionAttribute : CodeAccessSecurityAttribute
- {
- private String m_Name = null;
- private bool m_unrestricted = false;
-
- public NameIdPermissionAttribute (SecurityAction action): base( action )
- {
- }
-
- public String Name
- {
- get { return m_Name; }
- set { m_Name = value; }
- }
-
- public override IPermission CreatePermission ()
- {
- if (m_unrestricted)
- {
- throw new ArgumentException ("Unrestricted permissions not allowed in identity permissions.");
- }
- else
- {
- if (m_Name == null)
- return new NameIdPermission (PermissionState.None);
-
- return new NameIdPermission (m_Name);
- }
- }
- }
-}
-//
\ No newline at end of file
diff --git a/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/fileiopermission.cs b/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/fileiopermission.cs
deleted file mode 100644
index 500ac1e23f1..00000000000
--- a/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/fileiopermission.cs
+++ /dev/null
@@ -1,514 +0,0 @@
-// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml,
-// GetPathList and SetPathList methods, and the AllFiles and AllLocalFiles properties
-// of the FileIOPermission class.
-//
-using System;
-using System.Security;
-using System.Security.Permissions;
-using System.Collections;
-
-[assembly: CLSCompliant(true)]
-
-public class FileIOPermissionDemo
-{
- // IsSubsetOf determines whether the current permission is a subset of the specified permission.
- // This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess.
- //
- private bool IsSubsetOfDemo()
- {
-
- bool returnValue = true;
-
- string fileIO1, fileIO2;
- FileIOPermission fileIOPerm1, fileIOPerm2;
-
- FileIOGenerator fileIOGen1 = new FileIOGenerator();
- FileIOGenerator fileIOGen2 = new FileIOGenerator();
-
- fileIOGen1.ResetIndex();
- while (fileIOGen1.CreateFilePath(out fileIO1 ))
- {
- if(fileIO1 == "")
- fileIOPerm1 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, fileIO1);
-
- Console.WriteLine("**********************************************************\n");
-
- fileIOGen2.ResetIndex();
-
- while (fileIOGen2.CreateFilePath(out fileIO2))
- {
- if (fileIO2 == "")
- fileIOPerm2 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm2 = new FileIOPermission(FileIOPermissionAccess.AllAccess, fileIO2);
- string firstPermission = fileIO1 == "" | fileIO1 == null ? "null" : fileIO1;
- string secondPermission = fileIO2 == "" | fileIO2 == null ? "null" : fileIO2;
- if (fileIOPerm2 == null) continue;
- try
- {
- if (fileIOPerm1.IsSubsetOf(fileIOPerm2))
- {
-
- Console.WriteLine(firstPermission + " is a subset of " + secondPermission + "\n");
- }
- else
- {
- Console.WriteLine(firstPermission + " is not a subset of " + secondPermission + "\n");
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("An exception was thrown for subset :" + fileIO1 == "" ? "null" : fileIO1 + "\n" +
- fileIO2 == "" ? "null" : fileIO2 + "\n" + e);
- }
- }
- }
- return returnValue;
- }
- //
-
- // Union creates a new permission that is the union of the current permission and the specified permission.
- //
- private bool UnionDemo()
- {
-
- bool returnValue = true;
-
- string fileIO1, fileIO2;
- FileIOPermission fileIOPerm1, fileIOPerm2;
- IPermission fileIOPerm3;
-
- FileIOGenerator fileIOGen1 = new FileIOGenerator();
- FileIOGenerator fileIOGen2 = new FileIOGenerator();
-
- fileIOGen1.ResetIndex();
- while (fileIOGen1.CreateFilePath( out fileIO1 ))
- {
- if (fileIO1 == "")
- fileIOPerm1 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO1);
- if (fileIO1 == null) continue;
-
- Console.WriteLine("**********************************************************\n");
- fileIOGen2.ResetIndex();
-
- while (fileIOGen2.CreateFilePath( out fileIO2 ))
- {
- if (fileIO2 == "")
- fileIOPerm2 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm2 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO2);
- try
- {
- string firstPermission = fileIO1 == "" | fileIO1 == null ? "null" : fileIO1;
- string secondPermission = fileIO2 == "" | fileIO2 == null ? "null" : fileIO2;
- fileIOPerm3 = (FileIOPermission)fileIOPerm1.Union(fileIOPerm2);
- fileIOPerm3 = fileIOPerm1.Union(fileIOPerm2);
-
- if (fileIOPerm3 == null)
- {
- Console.WriteLine("The union of " + firstPermission + " and " + secondPermission + " is null.");
- }
- else
- {
- Console.WriteLine("The union of " + firstPermission + " and " + secondPermission +
- " = \n\t" + ((FileIOPermission)fileIOPerm3).GetPathList(FileIOPermissionAccess.Read)[0]);
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("An exception was thrown for union " + e);
- returnValue = false;
- }
- }
- }
-
- return returnValue;
- }
- //
-
- // Intersect creates and returns a new permission that is the intersection of the current
- // permission and the permission specified.
- //
- private bool IntersectDemo()
- {
-
- bool returnValue = true;
-
- string fileIO1, fileIO2;
- FileIOPermission fileIOPerm1, fileIOPerm2, fileIOPerm3;
-
- FileIOGenerator fileIOGen1 = new FileIOGenerator();
- FileIOGenerator fileIOGen2 = new FileIOGenerator();
-
- fileIOGen1.ResetIndex();
- while (fileIOGen1.CreateFilePath(out fileIO1 ))
- {
- if (fileIO1 == "")
- fileIOPerm1 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO1);
-
- Console.WriteLine("**********************************************************\n");
- fileIOGen2.ResetIndex();
-
- while (fileIOGen2.CreateFilePath( out fileIO2 ))
- {
- if (fileIO2 == "")
- fileIOPerm2 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm2 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO2);
- string firstPermission = fileIO1 == "" | fileIO1 == null ? "null" : fileIO1;
- string secondPermission = fileIO2 == "" | fileIO2 == null ? "null" : fileIO2;
- try
- {
-
- fileIOPerm3 = (FileIOPermission)fileIOPerm1.Intersect(fileIOPerm2);
- if (fileIOPerm3 != null && fileIOPerm3.GetPathList(FileIOPermissionAccess.Read) != null)
- {
-
- Console.WriteLine("The intersection of " + firstPermission + " and \n\t" + secondPermission +
- " = \n\t" + ((FileIOPermission)fileIOPerm3).GetPathList(FileIOPermissionAccess.Read)[0]);
- }
- else
- {
- Console.WriteLine("The intersection of " + firstPermission + " and " + secondPermission + " is null.");
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("An exception was thrown for intersection " + e);
- returnValue = false;
- }
- }
- }
-
- return returnValue;
- }
- //
-
- //Copy creates and returns an identical copy of the current permission.
- //
- private bool CopyDemo()
- {
- bool returnValue = true;
- string fileIO1;
- FileIOPermission fileIOPerm1, fileIOPerm2;
- FileIOGenerator fileIOGen1 = new FileIOGenerator();
- FileIOGenerator fileIOGen2 = new FileIOGenerator();
-
- fileIOGen1.ResetIndex();
- while (fileIOGen1.CreateFilePath( out fileIO1 ))
- {
- if (fileIO1 == "")
- fileIOPerm1 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO1);
-
- Console.WriteLine("**********************************************************\n");
- fileIOGen2.ResetIndex();
- try
- {
- fileIOPerm2 = (FileIOPermission)fileIOPerm1.Copy();
- if (fileIOPerm2 != null)
- {
- Console.WriteLine("Result of copy = " + fileIOPerm2.ToString() + "\n");
- }
- else
- {
- Console.WriteLine("Result of copy is null. \n");
- }
- }
- catch (Exception e)
- {
- {
- if (fileIO1 == "")
- {
- Console.WriteLine("The target FileIOPermission is empty, copy failed.");
- }
- else
- {
- Console.WriteLine(e);
- }
- }
- continue;
- }
- }
- return returnValue;
- }
- //
-
- // ToXml creates an XML encoding of the permission and its current state;
- // FromXml reconstructs a permission with the specified state from the XML encoding.
- //
- private bool ToFromXmlDemo()
- {
-
- bool returnValue = true;
-
- string fileIO1;
- FileIOPermission fileIOPerm1, fileIOPerm2;
-
- FileIOGenerator fileIOGen1 = new FileIOGenerator();
- FileIOGenerator fileIOGen2 = new FileIOGenerator();
-
- fileIOGen1.ResetIndex();
- while (fileIOGen1.CreateFilePath( out fileIO1 ))
- {
- if (fileIO1 == "")
- fileIOPerm1 = new FileIOPermission(PermissionState.None);
- else
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.Read, fileIO1);
-
- Console.WriteLine("********************************************************\n");
- fileIOGen2.ResetIndex();
- try
- {
- fileIOPerm2 = new FileIOPermission(PermissionState.None);
- fileIOPerm2.FromXml(fileIOPerm1.ToXml());
- Console.WriteLine("Result of ToFromXml = " + fileIOPerm2.ToString() + "\n");
- }
- catch (Exception e)
- {
- Console.WriteLine("ToFromXml failed :" + fileIOPerm1.ToString() + e);
- continue;
- }
- }
-
- return returnValue;
- }
- //
-
- // AddPathList adds access for the specified files and directories to the existing state of the permission.
- // SetPathList sets the specified access to the specified files and directories, replacing the existing state
- // of the permission.
- // GetPathList gets all files and directories that have the specified FileIOPermissionAccess.
- //
- private bool SetGetPathListDemo()
- {
- try
- {
- Console.WriteLine("********************************************************\n");
-
- FileIOPermission fileIOPerm1;
- Console.WriteLine("Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt");
- //
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\\Examples\\Test\\TestFile.txt");
- //
- Console.WriteLine("Adding 'C:\\Temp' to the write access list, and \n 'C:\\Examples\\Test' to read access.");
- fileIOPerm1.AddPathList(FileIOPermissionAccess.Write, "C:\\Temp");
- fileIOPerm1.AddPathList(FileIOPermissionAccess.Read, "C:\\Examples\\Test");
- string[] paths = fileIOPerm1.GetPathList(FileIOPermissionAccess.Read);
- Console.WriteLine("Read access before SetPathList = ");
- foreach (string path in paths)
- {
- Console.WriteLine("\t" + path);
- }
- Console.WriteLine("Setting the read access list to \n'C:\\Temp'");
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\\Temp");
- paths = fileIOPerm1.GetPathList(FileIOPermissionAccess.Read);
- Console.WriteLine("Read access list after SetPathList = ");
- foreach (string path in paths)
- {
- Console.WriteLine("\t" + path);
- }
-
- paths = fileIOPerm1.GetPathList(FileIOPermissionAccess.Write);
- Console.WriteLine("Write access list after SetPathList = ");
- foreach (string path in paths)
- {
- Console.WriteLine("\t" + path);
- }
-
- Console.WriteLine("Write access = \n" +
- fileIOPerm1.GetPathList(FileIOPermissionAccess.AllAccess));
- }
- catch (ArgumentException e)
- {
- // FileIOPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
- Console.WriteLine("An ArgumentException occurred as a result of using AllAccess. "
- + "This property cannot be used as a parameter in GetPathList "
- + "because it represents more than one type of file variable access. : \n" + e);
- }
-
- return true;
- }
- //
-
- // The AllFiles property gets or sets the permitted access to all files.
- // The AllLocalFiles property gets or sets the permitted access to all local files.
- //
- private bool AllFilesDemo()
- {
- try
- {
- Console.WriteLine("********************************************************\n");
-
- FileIOPermission fileIOPerm1;
- Console.WriteLine("Creating a FileIOPermission and adding read access for all files");
- fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\\Examples\\Test\\TestFile.txt");
- fileIOPerm1.AllFiles = FileIOPermissionAccess.Read;
- Console.WriteLine("AllFiles access = " + fileIOPerm1.AllFiles);
- Console.WriteLine("Adding AllAccess rights for local files.");
- fileIOPerm1.AllLocalFiles = FileIOPermissionAccess.AllAccess;
- Console.WriteLine("AllLocalFiles access = " + fileIOPerm1.AllLocalFiles);
- }
- catch (ArgumentException e)
- {
- Console.WriteLine(e);
- return false;
- }
-
- return true;
- }
- //
-
- // Invoke all demos.
- public bool RunDemo()
- {
-
- bool ret = true;
- bool retTmp;
- // Call the IsSubsetOfPath demo.
- if (retTmp = IsSubsetOfDemo()) Console.Out.WriteLine("IsSubsetOf demo completed successfully.");
- else Console.Out.WriteLine("IsSubsetOf demo failed.");
- ret = retTmp && ret;
-
- // Call the Union demo.
- if (retTmp = UnionDemo()) Console.Out.WriteLine("Union demo completed successfully.");
- else Console.Out.WriteLine("Union demo failed.");
- ret = retTmp && ret;
-
- // Call the Intersect demo.
- if (retTmp = IntersectDemo()) Console.Out.WriteLine("Intersect demo completed successfully.");
- else Console.Out.WriteLine("Intersect demo failed.");
- ret = retTmp && ret;
-
- // Call the Copy demo.
- if (retTmp = CopyDemo()) Console.Out.WriteLine("Copy demo completed successfully.");
- else Console.Out.WriteLine("Copy demo failed.");
- ret = retTmp && ret;
-
- // Call the ToFromXml demo.
- if (retTmp = ToFromXmlDemo()) Console.Out.WriteLine("ToFromXml demo completed successfully.");
- else Console.Out.WriteLine("ToFromXml demo failed.");
- ret = retTmp && ret;
-
- // Call the SetGetPathList demo.
- if (retTmp = SetGetPathListDemo()) Console.Out.WriteLine("SetGetPathList demo completed successfully.");
- else Console.Out.WriteLine("SetGetPathList demo failed.");
- ret = retTmp && ret;
-
- // Call the AllFiles demo.
- if (retTmp = AllFilesDemo()) Console.Out.WriteLine("AllFiles demo completed successfully.");
- else Console.Out.WriteLine("AllFiles demo failed.");
- ret = retTmp && ret;
-
- return (ret);
- }
- // Test harness.
- public static void Main(String[] args)
- {
- try
- {
- FileIOPermissionDemo democase = new FileIOPermissionDemo();
- bool ret = democase.RunDemo();
- if (ret)
- {
- Console.Out.WriteLine("FileIOPermission demo completed successfully.");
- Console.Out.WriteLine("Press the Enter key to exit.");
- string consoleInput = Console.ReadLine();
- System.Environment.ExitCode = 100;
- }
- else
- {
- Console.Out.WriteLine("FileIOPermission demo failed.");
- Console.Out.WriteLine("Press the Enter key to exit.");
- string consoleInput = Console.ReadLine();
- System.Environment.ExitCode = 101;
- }
- }
- catch (Exception e)
- {
- Console.Out.WriteLine("FileIOPermission demo failed");
- Console.WriteLine(e.ToString());
- Console.Out.WriteLine("Press the Enter key to exit.");
- string consoleInput = Console.ReadLine();
- System.Environment.ExitCode = 101;
- }
- }
-}
-
-// This class generates FileIOPermission objects.
-
-internal class FileIOGenerator
-{
-
- private string[] myFile =
-{
- "C:\\Examples\\Test\\TestFile.txt",
- "C:\\Examples\\Test\\",
- "C:\\Examples\\Test\\..",
- "C:\\Temp"
-};
-
- private FileIOPermissionAccess[] myAccess =
-{
- FileIOPermissionAccess.AllAccess,
- FileIOPermissionAccess.Append,
- FileIOPermissionAccess.NoAccess,
- FileIOPermissionAccess.PathDiscovery,
- FileIOPermissionAccess.Read,
- FileIOPermissionAccess.Write
-};
-
- private int fileIndex = 0;
-
- public FileIOGenerator()
- {
-
- ResetIndex();
- }
-
- public void ResetIndex()
- {
- fileIndex = 0;
- }
-
- // Create a file path string.
- //
- public bool CreateFilePath( out string file )
- {
-
- if (fileIndex == myFile.Length)
- {
-
- file = "";
- fileIndex++;
- return true;
- }
- if (fileIndex > myFile.Length)
- {
- file = "";
- return false;
- }
-
- file = myFile[fileIndex++];
-
- try
- {
- return true;
- }
- catch (Exception e)
- {
- Console.WriteLine("Cannot create FileIOPermission: " + file + " " + e);
- file = "";
- return true;
- }
- }
- //
-}
-//
diff --git a/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/remarks.cs b/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/remarks.cs
deleted file mode 100644
index 746d997cbdb..00000000000
--- a/snippets/csharp/System.Security.Permissions/FileIOPermission/GetPathList/remarks.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Security;
-using System.Security.Permissions;
-
-public class FileIOPermissionDemo
-{
- public static void Main()
- {
- try
- {
- FileIOPermission fileIOPerm1;
- fileIOPerm1 = new FileIOPermission(PermissionState.Unrestricted);
-
- // Tests for: SetPathList(FileIOPermissionAccess,String)
-
- // Test the Read list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\\documents");
-
- Console.WriteLine("Read access before SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Read))
- {
- Console.WriteLine("\t" + path);
- }
-
- //
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\\temp");
- //
-
- Console.WriteLine("Read access after SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Read))
- {
- Console.WriteLine("\t" + path);
- }
-
- // Test the Write list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, "C:\\temp");
-
- Console.WriteLine("Write access before SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Write))
- {
- Console.WriteLine("\t" + path);
- }
- //
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, "C:\\documents");
- //
-
- Console.WriteLine("Write access after SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Write))
- {
- Console.WriteLine("\t" + path);
- }
-
- // Tests for: SetPathList(FileIOPermissionAccess,String[])
-
- // Test the Read list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, new string[] {"C:\\pictures", "C:\\music"});
-
- Console.WriteLine("Read access before SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Read))
- {
- Console.WriteLine("\t" + path);
- }
-
- //
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, new string[] {"C:\\temp", "C:\\Documents"});
- //
-
- Console.WriteLine("Read access after SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Read))
- {
- Console.WriteLine("\t" + path);
- }
-
- // Test the Write list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, new string[] {"C:\\temp", "C:\\Documents"});
-
- Console.WriteLine("Write access before SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Write))
- {
- Console.WriteLine("\t" + path);
- }
- //
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, new string[] {"C:\\pictures", "C:\\music"});
- //
-
- Console.WriteLine("Write access after SetPathList = ");
- foreach (string path in fileIOPerm1.GetPathList(FileIOPermissionAccess.Write))
- {
- Console.WriteLine("\t" + path);
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
-}
diff --git a/snippets/csharp/System.Security/CodeAccessPermission/Overview/nameidpermission.cs b/snippets/csharp/System.Security/CodeAccessPermission/Overview/nameidpermission.cs
deleted file mode 100644
index 6247bb2012b..00000000000
--- a/snippets/csharp/System.Security/CodeAccessPermission/Overview/nameidpermission.cs
+++ /dev/null
@@ -1,240 +0,0 @@
-#define debug
-//
-//#define debug
-// This custom permission is intended only for the purposes of illustration.
-// The following code shows how to create a custom permission that inherits
-// from CodeAccessPermission. The code implements all required overrides.
-// A wildcard character ('*') is implemented for the Name property.
-using System;
-using System.Security;
-using System.Security.Permissions;
-using System.IO;
-using System.Security.Policy;
-using System.Collections;
-using System.Text;
-
-[assembly:System.Reflection.AssemblyKeyFile("Key.snk")]
-[assembly:System.Security.AllowPartiallyTrustedCallersAttribute()]
-
-namespace MyPermission
-{
- [Serializable()] sealed public class NameIdPermission : CodeAccessPermission, IUnrestrictedPermission
- {
- private String m_Name;
- private bool m_Unrestricted;
-
- public NameIdPermission(String name)
- {
- m_Name = name;
- }
-
- public NameIdPermission(PermissionState state)
- {
- if (state == PermissionState.None)
- {
- m_Name = "";
- }
- else
- if (state == PermissionState.Unrestricted)
- {
- throw new ArgumentException("Unrestricted state is not allowed for identity permissions.");
- }
- else
- {
- throw new ArgumentException("Invalid permission state.");
- }
- }
-
- public String Name
- {
- set{m_Name = value;}
- get{ return m_Name;}
- }
- //
- public override IPermission Copy()
- {
- string name = m_Name;
- return new NameIdPermission( name );
- }
- //
- //
- public bool IsUnrestricted()
- {
- // Always false, unrestricted state is not allowed.
- return m_Unrestricted;
- }
- //
-
- private bool VerifyType(IPermission target)
- {
- return (target is NameIdPermission);
- }
- //
- public override bool IsSubsetOf(IPermission target)
- {
-#if(debug)
- Console.WriteLine ("************* Entering IsSubsetOf *********************");
-#endif
- if (target == null)
- {
- Console.WriteLine ("IsSubsetOf: target == null");
- return false;
- }
-#if(debug)
-
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- try
- {
- NameIdPermission operand = ( NameIdPermission)target;
-
- // The following check for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if (true == operand.m_Unrestricted)
- {
- return true;
- }
- else if (true == this.m_Unrestricted)
- {
- return false;
- }
-
- if (this.m_Name != null)
- {
- if (operand.m_Name == null) return false;
-
- if (this.m_Name == "") return true;
- }
-
- if (this.m_Name.Equals (operand.m_Name))
- {
- return true;
- }
- else
- {
- // Check for wild card character '*'.
- int i = operand.m_Name.LastIndexOf ("*");
-
- if (i > 0)
- {
- string prefix = operand.m_Name.Substring (0, i);
-
- if (this.m_Name.StartsWith (prefix))
- {
- return true;
- }
- }
- }
-
- return false;
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException (String.Format ("Argument_WrongType", this.GetType ().FullName));
- }
- }
- //
- //
- public override IPermission Intersect(IPermission target)
- {
- Console.WriteLine ("************* Entering Intersect *********************");
- if (target == null)
- {
- return null;
- }
-#if(debug)
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- if (!VerifyType(target))
- {
- throw new ArgumentException (String.Format ("Argument is wrong type.", this.GetType ().FullName));
- }
-
- NameIdPermission operand = ( NameIdPermission)target;
-
- if (operand.IsSubsetOf (this)) return operand.Copy ();
- else if (this.IsSubsetOf (operand)) return this.Copy ();
- else
- return null;
- }
- //
-
- //
- public override IPermission Union(IPermission target)
- {
-#if(debug)
- Console.WriteLine ("************* Entering Union *********************");
-#endif
- if (target == null)
- {
- return this;
- }
-#if(debug)
- Console.WriteLine ("This is = " + (( NameIdPermission)this).Name);
- Console.WriteLine ("Target is " + (( NameIdPermission)target).m_Name);
-#endif
- if (!VerifyType(target))
- {
- throw new ArgumentException (String.Format ("Argument_WrongType", this.GetType ().FullName));
- }
-
- NameIdPermission operand = ( NameIdPermission)target;
-
- if (operand.IsSubsetOf (this)) return this.Copy ();
- else if (this.IsSubsetOf (operand)) return operand.Copy ();
- else
- return null;
- }
- //
- //
-
- //
- //
-
- //
- //
-
- //
- //
-
- //
- //
- public override void FromXml(SecurityElement e)
- {
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- String elUnrestricted = e.Attribute("Unrestricted");
- if (null != elUnrestricted)
- {
- m_Unrestricted = bool.Parse(elUnrestricted);
- return;
- }
-
- String elName = e.Attribute( "Name" );
- m_Name = elName == null ? null : elName;
- }
- //
- //
- public override SecurityElement ToXml()
- {
- // Use the SecurityElement class to encode the permission to XML.
- SecurityElement esd = new SecurityElement("IPermission");
- String name = typeof( NameIdPermission).AssemblyQualifiedName;
- esd.AddAttribute("class", name);
- esd.AddAttribute("version", "1.0");
-
- // The following code for unrestricted permission is only included as an example for
- // permissions that allow the unrestricted state. It is of no value for this permission.
- if (m_Unrestricted)
- {
- esd.AddAttribute("Unrestricted", true.ToString());
- }
- if (m_Name != null) esd.AddAttribute( "Name", m_Name );
- return esd;
- }
- //
- }
-}
-//
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient.sln b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient.sln
deleted file mode 100644
index 7d840ff6a81..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient.sln
+++ /dev/null
@@ -1,41 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.2.32602.215
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "designertestclient", "designertestclient\designertestclient.csproj", "{EB257019-9225-4B4D-B4FE-C6CD48A7E781}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nongenericparallelforeach", "parallelforeach\nongenericparallelforeach.csproj", "{196B50FD-7456-48F3-85BA-068E90DA2315}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Debug|Any CPU.ActiveCfg = Debug|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Debug|Any CPU.Build.0 = Debug|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Debug|x86.ActiveCfg = Debug|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Debug|x86.Build.0 = Debug|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Release|Any CPU.ActiveCfg = Release|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Release|Any CPU.Build.0 = Release|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Release|x86.ActiveCfg = Release|x86
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}.Release|x86.Build.0 = Release|x86
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Debug|x86.ActiveCfg = Debug|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Debug|x86.Build.0 = Debug|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Release|Any CPU.Build.0 = Release|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Release|x86.ActiveCfg = Release|Any CPU
- {196B50FD-7456-48F3-85BA-068E90DA2315}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {546BF6B5-C305-47EA-A293-9C9E18F6F41B}
- EndGlobalSection
-EndGlobal
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/app.config b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/app.config
deleted file mode 100644
index b03847a099d..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/app.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/designertestclient.csproj b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/designertestclient.csproj
deleted file mode 100644
index 31e49e94f61..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/designertestclient.csproj
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
- Debug
- x86
- 10.0
- 2.0
- {EB257019-9225-4B4D-B4FE-C6CD48A7E781}
- {32f31d43-81cc-4c15-9de6-3fc5453562b6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Exe
- Properties
- DesignerTestClient
- DesignerTestClient
- v4.8
-
- 512
-
-
- x86
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- x86
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
- {1dde6bf4-981e-4575-a738-9fbf46ec8d12}
- nongenericparallelforeach
-
-
-
-
-
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/program.cs b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/program.cs
deleted file mode 100644
index 3226b492eab..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/program.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-using System;
-using System.Activities;
-using System.Threading;
-
-namespace Microsoft.Samples.Activities.Statements
-{
- class Program
- {
- static void Main(string[] args)
- {
- WorkflowInvoker.Invoke(new Workflow1());
-
- Console.WriteLine("");
- Console.WriteLine("Press enter to exit...");
- Console.ReadLine();
- }
- }
-
- public class Helper
- {
- public static void ShowThreadId(string text)
- {
- Console.WriteLine(string.Format("Showing '{0}' in thread: {1}", text, Thread.CurrentThread.ManagedThreadId.ToString()));
- Thread.Sleep(1000);
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/properties/assemblyinfo.cs b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/properties/assemblyinfo.cs
deleted file mode 100644
index fc113e1dbfb..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/properties/assemblyinfo.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: ComVisible(false)]
-[assembly: AssemblyTitle("Microsoft.Samples.Activities.Statements")]
-[assembly: AssemblyDescription("Non generic ParallelForEach. Allows iterating through IEnumerable collections")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("Windows Communication Foundation and Windows Workflow Foundation SDK")]
-[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.*")]
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/workflow1.xaml b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/workflow1.xaml
deleted file mode 100644
index df82c3cf695..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/designertestclient/workflow1.xaml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
- True
-
-
-
-
-
- True
- False
-
-
-
-
- [names]
-
-
- [New ArrayList]
-
-
-
-
- [names]
-
- Bill
-
-
-
- [names]
-
- Steve
-
-
-
- [names]
-
- Ray
-
-
-
-
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml
deleted file mode 100644
index d17810ab73a..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Foreach
-
- in
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml.cs b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml.cs
deleted file mode 100644
index f5f45d9cdc2..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachdesigner.xaml.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-//----------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//----------------------------------------------------------------
-using System;
-using System.Activities.Presentation;
-
-namespace Microsoft.Samples.Activities.Statements.Presentation
-{
- ///
- /// Interaction logic for ForEachDesigner.xaml
- ///
- partial class ParallelForEachDesigner
- {
- public ParallelForEachDesigner()
- {
- //InitializeComponent();
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachwithbodyfactory.cs b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachwithbodyfactory.cs
deleted file mode 100644
index 7b59cb63e09..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/Designer/parallelforeachwithbodyfactory.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//-----------------------------------------------------------------------------
-using System.Activities;
-using System.Activities.Presentation;
-using System.Windows;
-
-namespace Microsoft.Samples.Activities.Statements.Presentation
-{
- // creates a ForEach activity with its Body (ActivityyAction) configured
- public sealed class ParallelForEachWithBodyFactory : IActivityTemplateFactory
- {
- public Activity Create(DependencyObject target)
- {
- return new Microsoft.Samples.Activities.Statements.ParallelForEach()
- {
- Body = new ActivityAction()
- {
- Argument = new DelegateInArgument()
- {
- Name = "item"
- }
- }
- };
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/nongenericparallelforeach.csproj b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/nongenericparallelforeach.csproj
deleted file mode 100644
index 9474a79f440..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/parallelforeach/nongenericparallelforeach.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Library
- net48
- latest
-
-
-
-
-
-
-
-
-
-
diff --git a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/snippets.5000.json b/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/snippets.5000.json
deleted file mode 100644
index da9ebf8da2f..00000000000
--- a/snippets/csharp/VS_Snippets_CFX/wfs_nongenericparallelforeach/cs/snippets.5000.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "host": "visualstudio"
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/Classic SmtpMail.Send Example/CS/smtpmailsend.cs b/snippets/csharp/VS_Snippets_WebNet/Classic SmtpMail.Send Example/CS/smtpmailsend.cs
deleted file mode 100644
index b7847781eb5..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/Classic SmtpMail.Send Example/CS/smtpmailsend.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace SMTPMailSendExample
-{
- class Class1
- {
- static void Main()
- {
- Send1();
- Send2();
- }
-
- public static void Send1()
- {
- //
- MailMessage myMail = new MailMessage();
- myMail.From = "from@microsoft.com";
- myMail.To = "to@microsoft.com";
- myMail.Subject = "UtilMailMessage001";
- myMail.Priority = MailPriority.Low;
- myMail.BodyFormat = MailFormat.Html;
- myMail.Body = "UtilMailMessage001 - success";
- MailAttachment myAttachment = new MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64);
- myMail.Attachments.Add(myAttachment);
- SmtpMail.SmtpServer = "MyMailServer";
- SmtpMail.Send(myMail);
- //
- }
-
- public static void Send2()
- {
- //
- string from = "from@microsoft.com";
- string to = "to@microsoft.com";
- string subject = "UtilMailMessage001";
- string body = "UtilMailMessage001 - success";
- SmtpMail.SmtpServer = "MyMailServer";
- SmtpMail.Send(from, to, subject, body);
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/CS/CustomAspNetClass.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/CS/CustomAspNetClass.cs
deleted file mode 100644
index b016a800e48..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/CS/CustomAspNetClass.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-//
-using System;
-using System.Web;
-using System.Security.Permissions;
-
-[AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Medium)]
-public class CustomAspNetClass
-{
-}
-//
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/CS/passportauthentication.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/CS/passportauthentication.cs
deleted file mode 100644
index 8ba8af6b08a..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/CS/passportauthentication.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Configuration;
-using System.Web;
-using System.Web.Configuration;
-
-class UsingPassportAuthentication
-{
-
-public UsingPassportAuthentication()
-{
-//
-
-// Get the configuration.
-// Get the Web application configuration.
-System.Configuration.Configuration configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
-
-// Get the section.
-System.Web.Configuration.AuthenticationSection authenticationSection = (System.Web.Configuration.AuthenticationSection)configuration.GetSection("system.web/authentication");
-
-// Get the authentication passport element.
-PassportAuthentication passport = authenticationSection.Passport;
-
-//
-
-//
-
-// Create a new passport object.
-PassportAuthentication newPassport = new PassportAuthentication();
-
-//
-
-//
-
-// Get the passport redirect URL
-string redirectUrl = passport.RedirectUrl;
-
-// Set passport redirect Url.
-passport.RedirectUrl = "passportLogin.aspx";
-
-if (!authenticationSection.SectionInformation.IsLocked)
- configuration.Save();
-
-//
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/CS/attachmentsample.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/CS/attachmentsample.cs
deleted file mode 100644
index 65c9d411d5b..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/CS/attachmentsample.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-#region Using directives
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Web.Mail;
-
-#endregion
-
-namespace AttachmentSample
-{
- class AttachmentSampleCS
- {
- static void Main(string[] args)
- {
- string fileName1 = args[0];
- string fileName2 = args[1];
-//
-MailMessage MyMessage = new MailMessage();
-MyMessage.Attachments.Add(new MailAttachment(fileName1));
-MyMessage.Attachments.Add(new MailAttachment(fileName2, MailEncoding.UUEncode));
-//
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/CS/systemwebmailmailmessagebcc.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/CS/systemwebmailmailmessagebcc.cs
deleted file mode 100644
index e67a669bcda..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/CS/systemwebmailmailmessagebcc.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.Bcc = "wilma@contoso.com";
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/CS/systemwebmailmailmessagebodyencoding.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/CS/systemwebmailmailmessagebodyencoding.cs
deleted file mode 100644
index 431831497f3..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/CS/systemwebmailmailmessagebodyencoding.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Web.Mail;
-using System.Text;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.BodyEncoding = Encoding.ASCII;
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/CS/systemwebmailmailmessagebodyformat.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/CS/systemwebmailmailmessagebodyformat.cs
deleted file mode 100644
index b718a5a99fc..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/CS/systemwebmailmailmessagebodyformat.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Web.Mail;
-using System.Text;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.BodyFormat = MailFormat.Html;
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/CS/systemwebmailmailmessagecc.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/CS/systemwebmailmailmessagecc.cs
deleted file mode 100644
index 0d2dc910651..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/CS/systemwebmailmailmessagecc.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.Cc = "fred@contoso.com";
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/CS/systemwebmailmailmessagepriority.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/CS/systemwebmailmailmessagepriority.cs
deleted file mode 100644
index 8ed94ce0f8f..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/CS/systemwebmailmailmessagepriority.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.Priority = MailPriority.Low;
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/CS/systemwebmailmailmessageurlcontentbase.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/CS/systemwebmailmailmessageurlcontentbase.cs
deleted file mode 100644
index 335c51d34fb..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/CS/systemwebmailmailmessageurlcontentbase.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.UrlContentBase="http://www.contoso.com/Employees";
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/CS/systemwebmailsmtpmailsmtpserver.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/CS/systemwebmailsmtpmailsmtpserver.cs
deleted file mode 100644
index 854a80fd014..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/CS/systemwebmailsmtpmailsmtpserver.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- //This example assigns the name of the mail relay server on the
- //local network to the SmtpServer property.
- SmtpMail.SmtpServer = "RelayServer.Contoso.com";
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/CS/systemwebmailsmtpmail.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/CS/systemwebmailsmtpmail.cs
deleted file mode 100644
index 275322ea18a..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/CS/systemwebmailsmtpmail.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-using System;
-using System.Web.Mail;
-
-namespace SendMail
-{
- class usage
- {
- public void DisplayUsage()
- {
- Console.WriteLine("Usage SendMail.exe ");
- Console.WriteLine(" the addresses of the email recipients");
- Console.WriteLine(" your email address");
- Console.WriteLine(" subject of your email");
- Console.WriteLine(" the text of the email");
- Console.WriteLine("Example:");
- Console.WriteLine("SendMail.exe SomeOne@Contoso.com;SomeOther@Contoso.com Me@contoso.com Hi hello");
- }
- }
-
- class Start
- {
- // The main entry point for the application.
- [STAThread]
- static void Main(string[] args)
- {
- try
- {
- try
- {
- MailMessage Message = new MailMessage();
- Message.To = args[0];
- Message.From = args[1];
- Message.Subject = args[2];
- Message.Body = args[3];
-
- try
- {
- SmtpMail.SmtpServer = "your mail server name goes here";
- SmtpMail.Send(Message);
- }
- catch(System.Web.HttpException ehttp)
- {
- Console.WriteLine("{0}", ehttp.Message);
- Console.WriteLine("Here is the full error message output");
- Console.Write("{0}", ehttp.ToString());
- }
- }
- catch(IndexOutOfRangeException)
- {
- usage use = new usage();
- use.DisplayUsage();
- }
- }
- catch(System.Exception e)
- {
- Console.WriteLine("Unknown Exception occurred {0}", e.Message);
- Console.WriteLine("Here is the Full Message output");
- Console.WriteLine("{0}", e.ToString());
- }
- }
- }
-}
-//
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/CS/passportidentity_authurl.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/CS/passportidentity_authurl.cs
deleted file mode 100644
index bf57c3e9686..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/CS/passportidentity_authurl.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Declare and set myURL variable = the URL of the appropriate Passport SignIn/SignOut Authority.
-string myURL = newPass.AuthUrl();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/CS/passportidentity_authurl2.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/CS/passportidentity_authurl2.cs
deleted file mode 100644
index bf57c3e9686..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/CS/passportidentity_authurl2.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Declare and set myURL variable = the URL of the appropriate Passport SignIn/SignOut Authority.
-string myURL = newPass.AuthUrl();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/CS/passportidentity_getdomainfrommembername.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/CS/passportidentity_getdomainfrommembername.cs
deleted file mode 100644
index 543eaefc6a5..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/CS/passportidentity_getdomainfrommembername.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Get the name of the Passport domain associated with the current UserName.
-string passportDomain = newPass.GetDomainFromMemberName(newPass.Name);
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/CS/passportidentity_hassavedpassword.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/CS/passportidentity_hassavedpassword.cs
deleted file mode 100644
index d73da909150..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/CS/passportidentity_hassavedpassword.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Set a string variable that indicates whether the user has a valid Passport ticket.
-String sHasTick = newPass.HasTicket.ToString();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/CS/passportidentity_isauthenticated.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/CS/passportidentity_isauthenticated.cs
deleted file mode 100644
index d3ac5891093..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/CS/passportidentity_isauthenticated.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Set the string sIsAuth to the users SignIn status (a boolean) converted to a string.
-String sIsAuth = newPass.IsAuthenticated.ToString();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/CS/passportidentity_logotag.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/CS/passportidentity_logotag.cs
deleted file mode 100644
index 10cd315ef17..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/CS/passportidentity_logotag.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Set a string to the URL of the appropriate Passport SignIn/SignOut authority.
-string sPassportlink = newPass.LogoTag();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/CS/passportidentity_logotag2.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/CS/passportidentity_logotag2.cs
deleted file mode 100644
index 8b0bef42e98..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/CS/passportidentity_logotag2.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Set a string to the URL of the appropriate Passport SignIn/SignOut authority.
-string sPassportlink = newPass.LogoTag2();
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/CS/passportidentity_name.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/CS/passportidentity_name.cs
deleted file mode 100644
index 5746557311a..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/CS/passportidentity_name.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Set a string variable to the Passport member name from the cookie.
-string sMemberName = newPass.Name;
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/CS/passportidentity_signout.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/CS/passportidentity_signout.cs
deleted file mode 100644
index 03f35d77840..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/CS/passportidentity_signout.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// This example demonstrates how to sign a user out of Passport.
-// local GIF file that the user is redirected to.
-string signOutGifFile = "signout.gif";
-// Signs the user out of their Passport Profile and displays the SignOut.gif file.
-System.Web.Security.PassportIdentity.SignOut(signOutGifFile);
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/CS/passportidentity_ticketage.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/CS/passportidentity_ticketage.cs
deleted file mode 100644
index 6e30df4e697..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/CS/passportidentity_ticketage.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Build a string with the elapsed time since the user's ticket was last refreshed with the Passport Authority.
-string sElapsedTime = "Elapsed time since ticket refresh: " + newPass.TicketAge.ToString() + " seconds.";
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/CS/passportidentity_timesincesignin.cs b/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/CS/passportidentity_timesincesignin.cs
deleted file mode 100644
index 524e31409a4..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/CS/passportidentity_timesincesignin.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Web.Security;
-
-namespace myPassportExamples
-{
-
-public class myPassportIdentity
-{
-public static void Main()
-{
-//
-// Declare new PassportIdendity object as variable newPass.
-System.Web.Security.PassportIdentity newPass = new System.Web.Security.PassportIdentity();
-// Build a string with the elapsed time since the user last signed in with the Passport Authority.
-string sElapsedTimeSignIn = "Elapsed time since SignIn: " + newPass.TimeSinceSignIn.ToString() + " seconds.";
-//
-}
-}
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailAttachment/CS/systemwebmailmailattachment.cs b/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailAttachment/CS/systemwebmailmailattachment.cs
deleted file mode 100644
index 0fba1161681..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailAttachment/CS/systemwebmailmailattachment.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- //This example shows how to programmatically add attached files
- //to a mail lessage.
-
- MailMessage myMail = new MailMessage();
-
- // Concatenate a list of attachment files in a string.
- string sAttach = @"C:\images\image1.jpg,C:\images\image2.jpg,C:\images\image3.jpg";
-
- // Build an IList of mail attachments using the files named in the string.
- char[] delim = new char[] {','};
- foreach (string sSubstr in sAttach.Split(delim))
- {
- MailAttachment myAttachment = new MailAttachment(sSubstr);
- myMail.Attachments.Add(myAttachment);
- }
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/CS/systemwebmailmailmessagefrom.cs b/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/CS/systemwebmailmailmessagefrom.cs
deleted file mode 100644
index f712e54df57..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/CS/systemwebmailmailmessagefrom.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.From = "john@contoso.com";
- //
- }
- }
-}
diff --git a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageTo/CS/systemwebmailmailmessageto.cs b/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageTo/CS/systemwebmailmailmessageto.cs
deleted file mode 100644
index 74c897e2512..00000000000
--- a/snippets/csharp/VS_Snippets_WebNet/SystemWebMailMailMessageTo/CS/systemwebmailmailmessageto.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Web.Mail;
-
-namespace MyNameSpace
-{
- class MyClass
- {
- static void Main(string[] args)
- {
- //
- MailMessage MyMessage = new MailMessage();
- MyMessage.To = "john@contoso.com";
- //
- }
- }
-}
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.PermissionSet/VB/permissionset.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.PermissionSet/VB/permissionset.vb
deleted file mode 100644
index 9d2fe556440..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.PermissionSet/VB/permissionset.vb
+++ /dev/null
@@ -1,138 +0,0 @@
-'
-' This sample demonstrates the use of the PermissionSet class.
-Imports System.Reflection
-Imports System.Security.Permissions
-Imports System.Security
-Imports System.IO
-Imports System.Collections
-
-Class [MyClass]
-
- Public Shared Sub PermissionSetDemo()
- Console.WriteLine("Executing PermissionSetDemo")
- Try
- '
- ' Open a new PermissionSet.
- Dim ps1 As New PermissionSet(PermissionState.None)
- Console.WriteLine("Adding permission to open a file from a file dialog box.")
- '
- ' Add a permission to the permission set.
- ps1.AddPermission(New FileDialogPermission(FileDialogPermissionAccess.Open))
- '
- Console.WriteLine("Demanding permission to open a file.")
- ps1.Demand()
- Console.WriteLine("Demand succeeded.")
- '
- Console.WriteLine("Adding permission to save a file from a file dialog box.")
- ps1.AddPermission(New FileDialogPermission(FileDialogPermissionAccess.Save))
- Console.WriteLine("Demanding permission to open and save a file.")
- ps1.Demand()
- Console.WriteLine("Demand succeeded.")
- Console.WriteLine("Adding permission to read environment variable USERNAME.")
- ps1.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"))
- ps1.Demand()
- Console.WriteLine("Demand succeeded.")
- Console.WriteLine("Adding permission to read environment variable COMPUTERNAME.")
- ps1.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Read, "COMPUTERNAME"))
- '
- ' Demand all the permissions in the set.
- Console.WriteLine("Demand all permissions.")
- ps1.Demand()
- '
- Console.WriteLine("Demand succeeded.")
- '
- ' Display the number of permissions in the set.
- Console.WriteLine("Number of permissions = " & ps1.Count)
- '
- '
- ' Display the value of the IsSynchronized property.
- Console.WriteLine("IsSynchronized property = " & ps1.IsSynchronized)
- '
- '
- ' Display the value of the IsReadOnly property.
- Console.WriteLine("IsReadOnly property = " & ps1.IsReadOnly)
- '
- '
- ' Display the value of the SyncRoot property.
- Console.WriteLine("SyncRoot property = " & CType(ps1.SyncRoot, PermissionSet).ToString())
- '
- '
- ' Display the result of a call to the ContainsNonCodeAccessPermissions method.
- ' Gets a value indicating whether the PermissionSet contains permissions
- ' that are not derived from CodeAccessPermission.
- ' Returns true if the PermissionSet contains permissions that are not
- ' derived from CodeAccessPermission; otherwise, false.
- Console.WriteLine("ContainsNonCodeAccessPermissions method returned " & ps1.ContainsNonCodeAccessPermissions())
- '
- '
- Console.WriteLine("Value of the permission set ToString = " & ControlChars.Lf & ps1.ToString())
- '
- Dim ps2 As New PermissionSet(PermissionState.None)
- '
- ' Create a second permission set and compare it to the first permission set.
- ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"))
- ps2.AddPermission(New EnvironmentPermission(EnvironmentPermissionAccess.Write, "COMPUTERNAME"))
- Console.WriteLine("Permissions in first permission set:")
- Dim list As IEnumerator = ps1.GetEnumerator()
- While list.MoveNext()
- Console.WriteLine(list.Current.ToString())
- End While
- Console.WriteLine("Second permission IsSubsetOf first permission = " & ps2.IsSubsetOf(ps1))
- '
- '
- ' Display the intersection of two permission sets.
- Dim ps3 As PermissionSet = ps2.Intersect(ps1)
- Console.WriteLine("The intersection of the first permission set and " & "the second permission set = " & ps3.ToString())
- '
- ' Create a new permission set.
- Dim ps4 As New PermissionSet(PermissionState.None)
- ps4.AddPermission(New FileIOPermission(FileIOPermissionAccess.Read, "C:\Temp\Testfile.txt"))
- ps4.AddPermission(New FileIOPermission(FileIOPermissionAccess.Read Or FileIOPermissionAccess.Write Or FileIOPermissionAccess.Append, "C:\Temp\Testfile.txt"))
- '
- ' Display the union of two permission sets.
- Dim ps5 As PermissionSet = ps3.Union(ps4)
- Console.WriteLine("The union of permission set 3 and permission set 4 = " & ps5.ToString())
- '
- '
- ' Remove FileIOPermission from the permission set.
- ps5.RemovePermission(GetType(FileIOPermission))
- Console.WriteLine("The last permission set after removing FileIOPermission = " & ps5.ToString())
- '
- '
- ' Change the permission set using SetPermission.
- ps5.SetPermission(New EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "USERNAME"))
- Console.WriteLine("Permission set after SetPermission = " & ps5.ToString())
- '
- '
- ' Display result of ToXml and FromXml operations.
- Dim ps6 As New PermissionSet(PermissionState.None)
- ps6.FromXml(ps5.ToXml())
- Console.WriteLine("Result of ToFromXml = " & ps6.ToString() & ControlChars.Lf)
- '
- '
- ' Display results of PermissionSet.GetEnumerator.
- Dim psEnumerator As IEnumerator = ps1.GetEnumerator()
- While psEnumerator.MoveNext()
- Console.WriteLine(psEnumerator.Current)
- End While
- '
- '
- ' Check for an unrestricted permission set.
- Dim ps7 As New PermissionSet(PermissionState.Unrestricted)
- Console.WriteLine("Permission set is unrestricted = " & ps7.IsUnrestricted())
- '
- '
- ' Create and display a copy of a permission set.
- ps7 = ps5.Copy()
- Console.WriteLine("Result of copy = " & ps7.ToString())
- '
- Catch e As Exception
- Console.WriteLine(e.Message.ToString())
- End Try
- End Sub
-
- Overloads Shared Sub Main(ByVal args() As String)
- PermissionSetDemo()
- End Sub
-End Class
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/VB/nameidpermissionattribute.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/VB/nameidpermissionattribute.vb
deleted file mode 100644
index bb5269089df..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/VB/nameidpermissionattribute.vb
+++ /dev/null
@@ -1,45 +0,0 @@
-'
-Imports System.IO
-Imports System.Runtime.Remoting
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Reflection
-Imports MyPermission
-
-' Use the command line option '/keyfile' or appropriate project settings to sign this assembly.
-
-Namespace MyPermissionAttribute
-
- Public NotInheritable Class NameIdPermissionAttribute
- Inherits CodeAccessSecurityAttribute
- Private m_Name As String = Nothing
- Private m_unrestricted As Boolean = False
-
-
- Public Sub New(ByVal action As SecurityAction)
- MyBase.New(action)
- End Sub
-
-
- Public Property Name() As String
- Get
- Return m_name
- End Get
- Set(ByVal Value As String)
- m_name = Value
- End Set
- End Property
-
- Public Overrides Function CreatePermission() As IPermission
- If m_unrestricted Then
- Throw New ArgumentException("Unrestricted permissions not allowed in identity permissions.")
- Else
- If m_name Is Nothing Then
- Return New NameIdPermission(PermissionState.None)
- End If
- Return New NameIdPermission(m_name)
- End If
- End Function 'CreatePermission
- End Class
-End Namespace
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/VB/dataprotect.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/VB/dataprotect.vb
deleted file mode 100644
index ea368b0b998..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/VB/dataprotect.vb
+++ /dev/null
@@ -1,172 +0,0 @@
-'
-Imports System.Security.Permissions
-Imports System.Security.Cryptography
-Imports System.Security
-Imports System.IO
-
-
-
-Public Class DataProtect
- ' Create a byte array for additional entropy when using the
- ' Protect and Unprotect methods.
- Private Shared s_additionalEntropy As Byte() = {9, 8, 7, 6, 5}
-
- Private Shared encryptedSecret() As Byte
- Private Shared originalData() As Byte
-
- Public Shared Sub Main(ByVal args() As String)
- '
- Console.WriteLine("Creating a permission with the Flags property =" + " ProtectData.")
- Dim sp As New DataProtectionPermission(DataProtectionPermissionFlags.ProtectData)
- sp.PermitOnly()
- '
- ' Protect the data
- ProtectData()
- ' This should fail without the correct permission
- UnprotectData()
- ' Revert the permission that limited access
- CodeAccessPermission.RevertPermitOnly()
-
- ' This should now work.
- UnprotectData()
- ' Demonstrate the behavior of the class members.
- ShowMembers()
-
- Console.WriteLine("Press the Enter key to exit.")
- Console.ReadKey()
- Return
-
- End Sub
-
-
- ' The following method is intended to demonstrate only the behavior of
- ' DataProtectionPermission class members,and not their practical usage.
- ' Most properties and methods in this class are used for the resolution
- ' and enforcement of security policy by the security infrastructure code.
- Private Shared Sub ShowMembers()
- Console.WriteLine("Creating four DataProtectionPermissions")
- Console.WriteLine("Creating the first permission with the Flags " + "property = ProtectData.")
- Dim sp1 As New DataProtectionPermission(DataProtectionPermissionFlags.ProtectData)
-
- Console.WriteLine("Creating the second permission with the Flags " + "property = AllFlags.")
-
- Dim sp2 As New DataProtectionPermission(DataProtectionPermissionFlags.AllFlags)
-
- Console.WriteLine("Creating the third permission with a permission " + "state = Unrestricted.")
- '
- Dim sp3 As New DataProtectionPermission(PermissionState.Unrestricted)
- '
- Console.WriteLine("Creating the fourth permission with a permission" + " state = None.")
-
- Dim sp4 As New DataProtectionPermission(PermissionState.None)
- '
- Dim rc As Boolean = sp2.IsSubsetOf(sp3)
- Console.WriteLine("Is the permission with all flags set (AllFlags) " + "a subset of " + vbLf + " " + vbTab + "the permission with an Unrestricted " + "permission state? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
- rc = sp1.IsSubsetOf(sp2)
- Console.WriteLine("Is the permission with ProtectData access a " + "subset of the permission with " + vbLf + vbTab + "AllFlags set? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
- '
- '
- rc = sp3.IsUnrestricted()
- Console.WriteLine("Is the third permission unrestricted? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
- '
- '
- Console.WriteLine("Copying the second permission to the fourth " + "permission.")
- sp4 = CType(sp2.Copy(), DataProtectionPermission)
- rc = sp4.Equals(sp2)
- Console.WriteLine("Is the fourth permission equal to the second " + "permission? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
- '
- '
- Console.WriteLine("Creating the intersection of the second and " + "first permissions.")
- sp4 = CType(sp2.Intersect(sp1), DataProtectionPermission)
- Console.WriteLine("The value of the Flags property is: " + sp4.Flags.ToString())
- '
- '
- Console.WriteLine("Creating the union of the second and first " + "permissions.")
- sp4 = CType(sp2.Union(sp1), DataProtectionPermission)
- Console.WriteLine("Result of the union of the second permission with the first: " + sp4.Flags.ToString())
- '
- '
- Console.WriteLine("Using an XML round trip to reset the fourth " + "permission.")
- sp4.FromXml(sp2.ToXml())
- rc = sp4.Equals(sp2)
- Console.WriteLine("Does the XML round trip result equal the " + "original permission? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
-
- End Sub
-
- '
-
- ' Create a simple byte array containing data to be encrypted.
- Public Shared Sub ProtectData()
- Dim secret As Byte() = {0, 1, 2, 3, 4, 1, 2, 3, 4}
-
- 'Encrypt the data.
- encryptedSecret = Protect(secret)
- Console.WriteLine("The encrypted byte array is:")
- If Not (encryptedSecret Is Nothing) Then
- PrintValues(encryptedSecret)
- End If
-
- End Sub
-
-
- ' Decrypt the data and store in a byte array.
- Public Shared Sub UnprotectData()
- originalData = Unprotect(encryptedSecret)
- If Not (originalData Is Nothing) Then
- Console.WriteLine(vbCr + vbLf + "The original data is:")
- PrintValues(originalData)
- End If
-
- End Sub
-
-
- ' Encrypt data in the specified byte array.
- Public Shared Function Protect(ByVal data() As Byte) As Byte()
- Try
- ' Encrypt the data using DataProtectionScope.CurrentUser.
- ' The result can be decrypted only by the user who encrypted
- ' the data.
- Return ProtectedData.Protect(data, s_additionalEntropy, DataProtectionScope.CurrentUser)
- Catch e As CryptographicException
- Console.WriteLine("Data was not encrypted. " + "An error has occurred.")
- Console.WriteLine(e.ToString())
- Return Nothing
- Catch e As SecurityException
- Console.WriteLine("Insufficient permissions. " + "An error has occurred.")
- Console.WriteLine(e.ToString())
- Return Nothing
- End Try
-
- End Function 'Protect
-
-
- ' Decrypt data in the specified byte array.
- Public Shared Function Unprotect(ByVal data() As Byte) As Byte()
- Try
- 'Decrypt the data using DataProtectionScope.CurrentUser.
- Return ProtectedData.Unprotect(data, s_additionalEntropy, DataProtectionScope.CurrentUser)
- Catch e As CryptographicException
- Console.WriteLine("Data was not decrypted. " + "An error has occurred.")
- Console.WriteLine(e.ToString())
- Return Nothing
- Catch e As SecurityException
- Console.WriteLine("Insufficient permissions. " + "An error has occurred.")
- Console.WriteLine(e.ToString())
- Return Nothing
- End Try
-
- End Function 'Unprotect
-
-
- Public Shared Sub PrintValues(ByVal myArr() As [Byte])
- Dim i As [Byte]
- For Each i In myArr
- Console.Write(vbTab + "{0}", i)
- Next i
- Console.WriteLine()
-
- End Sub
-End Class
-
-
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.EnvironmentPermission/VB/environmentpermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.EnvironmentPermission/VB/environmentpermission.vb
deleted file mode 100644
index 962fd946c9d..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.EnvironmentPermission/VB/environmentpermission.vb
+++ /dev/null
@@ -1,258 +0,0 @@
- ' This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml and FromXml methods
-' of the EnvironmentPermission class.
-'
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Collections
-
-
-Public Class EnvironmentPermissionDemo
-
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- '
- Private Function IsSubsetOfDemo() As Boolean
- Dim returnValue As Boolean = True
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "windir")
- Dim envPerm2 As New EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "TEMP")
- If envPerm1.IsSubsetOf(envPerm2) Then
-
- Console.WriteLine("'windir' is a subset of 'TEMP'" + vbLf)
- Else
- Console.WriteLine("windir" + " is not a subset of " + "TEMP" + vbLf)
- End If
- envPerm1.SetPathList(EnvironmentPermissionAccess.Read, "TEMP")
-
- If envPerm1.IsSubsetOf(envPerm2) Then
-
- Console.WriteLine("Read access is a subset of AllAccess" + vbLf)
- Else
- Console.WriteLine("Read access is not a subset of AllAccess" + vbLf)
- End If
-
- Return returnValue
-
- End Function 'IsSubsetOfDemo
-
- '
- ' Union creates a new permission that is the union of the current permission and the specified permission.
- '
- Private Function UnionDemo() As Boolean
- Dim returnValue As Boolean = True
- Dim envIdPerm3 As IPermission
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "windir")
- Dim envPerm2 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "TEMP")
- envIdPerm3 = CType(envPerm1.Union(envPerm2), EnvironmentPermission)
- envIdPerm3 = envPerm1.Union(envPerm2)
- Console.WriteLine("The union of 'windir' and 'TEMP'" + " = " + _
- CType(envIdPerm3, EnvironmentPermission).GetPathList(EnvironmentPermissionAccess.Read).ToString())
-
- Return returnValue
-
- End Function 'UnionDemo
-
- '
- ' Intersect creates and returns a new permission that is the intersection of
- ' the current permission and the permission specified.
- '
- Private Function IntersectDemo() As Boolean
-
- Dim envIdPerm3 As IPermission
- Dim returnValue As Boolean = True
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "windir")
- Dim envPerm2 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "TEMP")
- Try
- envIdPerm3 = CType(envPerm1.Intersect(envPerm2), EnvironmentPermission)
- If Not (envIdPerm3 Is Nothing) AndAlso Not (CType(envIdPerm3, _
- EnvironmentPermission).GetPathList(EnvironmentPermissionAccess.Read) Is Nothing) Then
- Console.WriteLine("The intersection of " + "windir" + " and " + "TEMP" + _
- " = " + CType(envIdPerm3, EnvironmentPermission).GetPathList(EnvironmentPermissionAccess.Read).ToString())
- Else
- Console.WriteLine("The intersection of " + "windir" + " and " + "TEMP" + " is null.")
- End If
- Catch e As Exception
- Console.WriteLine("An exception was thrown for intersection : " + e.Message)
- returnValue = False
- End Try
-
- Return returnValue
-
- End Function 'IntersectDemo
-
- '
- 'Copy creates and returns an identical copy of the current permission.
- '
- Private Function CopyDemo() As Boolean
- Dim returnValue As Boolean = True
- '
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "windir")
- '
- Try
- Dim envPerm2 As EnvironmentPermission = CType(envPerm1.Copy(), EnvironmentPermission)
- If Not (envPerm2 Is Nothing) Then
- Console.WriteLine("Result of copy = " + envPerm2.ToString() + vbLf)
- Else
- Console.WriteLine("Result of copy is null. " + vbLf)
- End If
- Catch e As Exception
- Console.WriteLine(e)
- End Try
-
- Return returnValue
-
- End Function 'CopyDemo
-
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs
- ' a permission with the specified state from the XML encoding.
- '
- Private Function ToFromXmlDemo() As Boolean
- Dim returnValue As Boolean = True
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.Read, "windir")
- Dim envPerm2 As New EnvironmentPermission(PermissionState.None)
- envPerm2.FromXml(envPerm1.ToXml())
- Console.WriteLine("Result of ToFromXml = " + envPerm2.ToString() + vbLf)
-
- Return returnValue
-
- End Function 'ToFromXmlDemo
-
- '
- ' AddPathList adds access for the specified environment variables to the existing state of the permission.
- ' SetPathList Sets the specified access to the specified environment variables to the existing state
- ' of the permission.
- ' GetPathList gets all environment variables with the specified EnvironmentPermissionAccess.
- '
- Private Function SetGetPathListDemo() As Boolean
- Try
- Console.WriteLine("********************************************************" + vbLf)
- '
- Console.WriteLine("Creating an EnvironmentPermission with AllAccess rights for 'TMP'")
- Dim envPerm1 As New EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "TMP")
- '
- Console.WriteLine("Adding 'TEMP' to the write access list, and 'windir' to the read access list.")
- envPerm1.AddPathList(EnvironmentPermissionAccess.Write, "TEMP")
- envPerm1.AddPathList(EnvironmentPermissionAccess.Read, "windir")
- Console.WriteLine("Read access list before SetPathList = " + envPerm1.GetPathList(EnvironmentPermissionAccess.Read))
- Console.WriteLine("Setting read access to 'TMP'")
- envPerm1.SetPathList(EnvironmentPermissionAccess.Read, "TMP")
- Console.WriteLine("Read access list after SetPathList = " + envPerm1.GetPathList(EnvironmentPermissionAccess.Read))
- Console.WriteLine("Write access list = " + envPerm1.GetPathList(EnvironmentPermissionAccess.Write))
- Console.WriteLine("Write access environment variables = " + envPerm1.GetPathList(EnvironmentPermissionAccess.AllAccess))
- Catch e As ArgumentException
- ' EnvironmentPermissionAccess.AllAccess cannot be used as a parameter for GetPathList.
- Console.WriteLine("An ArgumentException occurred as a result of using AllAccess. " + _
- " This property cannot be used as a parameter in GetPathList, because it represents " + _
- "more than one type of environment variable : " + vbLf + e.Message)
- End Try
-
- Return True
-
- End Function 'SetGetPathListDemo
-
- '
- ' Invoke all demos.
- Public Function RunDemo() As Boolean
-
- Dim ret As Boolean = True
- Dim retTmp As Boolean
- ' Call IsSubsetOf demo.
- retTmp = IsSubsetOfDemo()
- If retTmp Then
-
- Console.Out.WriteLine("IsSubset demo completed successfully.")
- Else
- Console.Out.WriteLine("IsSubset demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call Union demo.
- retTmp = UnionDemo()
- If retTmp Then
-
- Console.Out.WriteLine("Union demo completed successfully.")
- Else
- Console.Out.WriteLine("Union demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call Intersect demo.
- retTmp = IntersectDemo()
- If retTmp Then
-
- Console.Out.WriteLine("Intersect demo completed successfully.")
- Else
- Console.Out.WriteLine("Intersect demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
-
-
- ' Call Copy demo.
- retTmp = CopyDemo()
- If retTmp Then
-
- Console.Out.WriteLine("Copy demo completed successfully.")
- Else
- Console.Out.WriteLine("Copy demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call ToFromXml demo.
- retTmp = ToFromXmlDemo()
- If retTmp Then
-
- Console.Out.WriteLine("ToFromXml demo completed successfully.")
- Else
- Console.Out.WriteLine("ToFromXml demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call SetGetPathList demo.
- retTmp = SetGetPathListDemo()
- If retTmp Then
-
- Console.Out.WriteLine("SetGetPathList demo completed successfully.")
- Else
- Console.Out.WriteLine("SetGetPathList demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- Return ret
-
- End Function 'RunDemo
-
- ' Test harness.
- Public Shared Sub Main(ByVal args() As String)
- Try
- Dim democase As New EnvironmentPermissionDemo()
- Dim ret As Boolean = democase.RunDemo()
- If ret Then
- Console.Out.WriteLine("EnvironmentPermission demo completed successfully.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 100
- Else
- Console.Out.WriteLine("EnvironmentPermission demo failed.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End If
- Catch e As Exception
- Console.Out.WriteLine("EnvironmentPermission demo failed.")
- Console.WriteLine(e.ToString())
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End Try
-
- End Sub
-End Class
-
-
-
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/fileiopermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/fileiopermission.vb
deleted file mode 100644
index 922ca7d0195..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/fileiopermission.vb
+++ /dev/null
@@ -1,480 +0,0 @@
-' This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml,
-' GetPathList and SetPathList methods, and the AllFiles and AllLocalFiles properties
-' of the FileIOPermission class.
-'
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Collections
-
-
-
-Public Class FileIOPermissionDemo
-
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- ' This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess.
- '
- Private Function IsSubsetOfDemo() As Boolean
-
- Dim returnValue As Boolean = True
- Dim fileIO1 As String = ""
- Dim fileIO2 As String = ""
- Dim fileIOPerm1, fileIOPerm2 As FileIOPermission
-
- Dim fileIOGen1 As New FileIOGenerator()
- Dim fileIOGen2 As New FileIOGenerator()
-
- fileIOGen1.ResetIndex()
- While fileIOGen1.CreateFilePath(fileIO1)
- If fileIO1 = "" Then
- fileIOPerm1 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, fileIO1)
- End If
-
- Console.WriteLine("**********************************************************" & ControlChars.Lf)
-
- fileIOGen2.ResetIndex()
-
- While fileIOGen2.CreateFilePath(fileIO2)
- If fileIO2 = "" Then
- fileIOPerm2 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm2 = New FileIOPermission(FileIOPermissionAccess.AllAccess, fileIO2)
- End If
- Dim firstPermission As String = IIf(fileIO1 = "" Or fileIO1 Is Nothing, "null", fileIO1)
- Dim secondPermission As String = IIf(fileIO2 = "" Or fileIO2 Is Nothing, "null", fileIO2)
- If fileIOPerm2 Is Nothing Then
- Continue While
- End If
- Try
- If fileIOPerm1.IsSubsetOf(fileIOPerm2) Then
-
- Console.WriteLine((firstPermission & " is a subset of " & secondPermission & ControlChars.Lf))
- Else
- Console.WriteLine((firstPermission & " is not a subset of " & secondPermission & ControlChars.Lf))
- End If
-
- Catch e As Exception
- Console.WriteLine(IIf("An exception was thrown for subset :" & fileIO1 = "", "null", IIf(fileIO1 & ControlChars.Lf & fileIO2 = "", "null", fileIO2 & ControlChars.Lf & e.ToString())))
- End Try
-
- End While
-
- End While
- Return returnValue
- End Function 'IsSubsetOfDemo
- '
-
- ' Union creates a new permission that is the union of the current permission and the specified permission.
- '
- Private Function UnionDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim fileIO1 As String = ""
- Dim fileIO2 As String = ""
- Dim fileIOPerm1, fileIOPerm2 As FileIOPermission
- Dim fileIOPerm3 As IPermission
-
- Dim fileIOGen1 As New FileIOGenerator()
- Dim fileIOGen2 As New FileIOGenerator()
-
- fileIOGen1.ResetIndex()
- While fileIOGen1.CreateFilePath(fileIO1)
- If fileIO1 = "" Then
- fileIOPerm1 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO1)
- End If
- Console.WriteLine("**********************************************************" & ControlChars.Lf)
- fileIOGen2.ResetIndex()
-
- While fileIOGen2.CreateFilePath(fileIO2)
-
- Try
- If fileIO2 = "" Then
- fileIOPerm2 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm2 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO2)
- End If
- Dim firstPermission As String = IIf(fileIO1 = "" Or fileIO1 Is Nothing, "null", fileIO1)
- Dim secondPermission As String = IIf(fileIO2 = "" Or fileIO2 Is Nothing, "null", fileIO2)
- fileIOPerm3 = CType(fileIOPerm1.Union(fileIOPerm2), FileIOPermission)
- fileIOPerm3 = fileIOPerm1.Union(fileIOPerm2)
-
- If fileIOPerm3 Is Nothing Then
- Console.WriteLine(("The union of " & firstPermission & " and " & secondPermission & " is null."))
- Else
- Console.WriteLine(("The union of " & firstPermission & " and " & secondPermission & " = " & ControlChars.Lf & ControlChars.Tab & CType(fileIOPerm3, FileIOPermission).GetPathList(FileIOPermissionAccess.Read)(0)))
- End If
- Catch e As Exception
- Console.WriteLine(("An exception was thrown for union " & e.ToString()))
- returnValue = False
- End Try
-
- End While
-
- End While
-
-
- Return returnValue
- End Function 'UnionDemo
- '
-
- ' Intersect creates and returns a new permission that is the intersection of the current
- ' permission and the permission specified.
- '
- Private Function IntersectDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim fileIO1 As String = ""
- Dim fileIO2 As String = ""
- Dim fileIOPerm1, fileIOPerm2, fileIOPerm3 As FileIOPermission
-
- Dim fileIOGen1 As New FileIOGenerator()
- Dim fileIOGen2 As New FileIOGenerator()
-
- fileIOGen1.ResetIndex()
- While fileIOGen1.CreateFilePath(fileIO1)
- If fileIO1 = "" Then
- fileIOPerm1 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO1)
- End If
- Console.WriteLine("**********************************************************" & ControlChars.Lf)
- fileIOGen2.ResetIndex()
-
- While fileIOGen2.CreateFilePath(fileIO2)
- If fileIO2 = "" Then
- fileIOPerm2 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm2 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO2)
- End If
- Dim firstPermission As String = IIf(fileIO1 = "" Or fileIO1 Is Nothing, "null", fileIO1)
- Dim secondPermission As String = IIf(fileIO2 = "" Or fileIO2 Is Nothing, "null", fileIO2)
- Try
-
- fileIOPerm3 = CType(fileIOPerm1.Intersect(fileIOPerm2), FileIOPermission)
- If Not (fileIOPerm3 Is Nothing) AndAlso Not (fileIOPerm3.GetPathList(FileIOPermissionAccess.Read) Is Nothing) Then
-
- Console.WriteLine(("The intersection of " & firstPermission & " and " & ControlChars.Lf & ControlChars.Tab & secondPermission & " = " & ControlChars.Lf & ControlChars.Tab & CType(fileIOPerm3, FileIOPermission).GetPathList(FileIOPermissionAccess.Read)(0)))
- Else
- Console.WriteLine(("The intersection of " & firstPermission & " and " & secondPermission & " is null."))
- End If
- Catch e As Exception
- Console.WriteLine(("An exception was thrown for intersection " & e.ToString()))
- returnValue = False
- End Try
-
- End While
-
- End While
-
- Return returnValue
- End Function 'IntersectDemo
- '
-
- 'Copy creates and returns an identical copy of the current permission.
- '
- Private Function CopyDemo() As Boolean
- Dim returnValue As Boolean = True
- Dim fileIO1 As String = ""
- Dim fileIOPerm1, fileIOPerm2 As FileIOPermission
- Dim fileIOGen1 As New FileIOGenerator()
- Dim fileIOGen2 As New FileIOGenerator()
-
- fileIOGen1.ResetIndex()
- While fileIOGen1.CreateFilePath(fileIO1)
- If fileIO1 = "" Then
- fileIOPerm1 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO1)
- End If
- Console.WriteLine("**********************************************************" & ControlChars.Lf)
- fileIOGen2.ResetIndex()
- Try
- fileIOPerm2 = CType(fileIOPerm1.Copy(), FileIOPermission)
- If Not (fileIOPerm2 Is Nothing) Then
- Console.WriteLine(("Result of copy = " & fileIOPerm2.ToString() & ControlChars.Lf))
- Else
- Console.WriteLine("Result of copy is null. " & ControlChars.Lf)
- End If
- Catch e As Exception
- If (True.ToString()) Then
- If fileIO1 = "" Then
- Console.WriteLine("The target FileIOPermission is empty, copy failed.")
-
- Else
- Console.WriteLine(e.ToString())
- End If
- End If
- Continue While
- End Try
-
- End While
- Return returnValue
- End Function 'CopyDemo
- '
-
- ' ToXml creates an XML encoding of the permission and its current state;
- ' FromXml reconstructs a permission with the specified state from the XML encoding.
- '
- Private Function ToFromXmlDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim fileIO1 As String = ""
- Dim fileIOPerm1, fileIOPerm2 As FileIOPermission
-
- Dim fileIOGen1 As New FileIOGenerator()
- Dim fileIOGen2 As New FileIOGenerator()
-
- fileIOGen1.ResetIndex()
- While fileIOGen1.CreateFilePath(fileIO1)
- If fileIO1 = "" Then
- fileIOPerm1 = New FileIOPermission(PermissionState.None)
- Else
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.Read, fileIO1)
- End If
- Console.WriteLine("********************************************************" & ControlChars.Lf)
- fileIOGen2.ResetIndex()
- Try
- fileIOPerm2 = New FileIOPermission(PermissionState.None)
- fileIOPerm2.FromXml(fileIOPerm1.ToXml())
- Console.WriteLine(("Result of ToFromXml = " & fileIOPerm2.ToString() & ControlChars.Lf))
-
- Catch e As Exception
- Console.WriteLine(("ToFromXml failed :" & fileIOPerm1.ToString() & e.ToString()))
- Continue While
- End Try
-
- End While
-
- Return returnValue
- End Function 'ToFromXmlDemo
- '
-
- ' AddPathList adds access for the specified files and directories to the existing state of the permission.
- ' SetPathList sets the specified access to the specified files and directories, replacing the existing state
- ' of the permission.
- ' GetPathList gets all files and directories that have the specified FileIOPermissionAccess.
- '
- Private Function SetGetPathListDemo() As Boolean
- Try
- Console.WriteLine("********************************************************" & ControlChars.Lf)
-
- Dim fileIOPerm1 As FileIOPermission
- Console.WriteLine("Creating a FileIOPermission with AllAccess rights for 'C:\Examples\Test\TestFile.txt")
- '
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\Examples\Test\TestFile.txt")
- '
- Console.WriteLine("Adding 'C:\Temp' to the write access list, and " & ControlChars.Lf & " 'C:\Examples\Test' to read access.")
- fileIOPerm1.AddPathList(FileIOPermissionAccess.Write, "C:\Temp")
- fileIOPerm1.AddPathList(FileIOPermissionAccess.Read, "C:\Examples\Test")
- Dim paths As String() = fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine("Read access before SetPathList = ")
- Dim path As String
- For Each path In paths
- Console.WriteLine((ControlChars.Tab & path))
- Next path
- Console.WriteLine("Setting the read access list to " & ControlChars.Lf & "'C:\Temp'")
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\Temp")
- paths = fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine("Read access list after SetPathList = ")
- For Each path In paths
- Console.WriteLine((ControlChars.Tab & path))
- Next path
-
- paths = fileIOPerm1.GetPathList(FileIOPermissionAccess.Write)
- Console.WriteLine("Write access list after SetPathList = ")
- For Each path In paths
- Console.WriteLine((ControlChars.Tab & path))
- Next path
-
- Dim pathList() As String
- pathList = fileIOPerm1.GetPathList(FileIOPermissionAccess.AllAccess)
-
- Catch e As ArgumentException
- ' FileIOPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
- Console.WriteLine(("An ArgumentException occurred as a result of using AllAccess. " & "This property cannot be used as a parameter in GetPathList " & "because it represents more than one type of file variable access. : " & ControlChars.Lf & e.ToString()))
- End Try
-
- Return True
- End Function 'SetGetPathListDemo
- '
-
- ' The AllFiles property gets or sets the permitted access to all files.
- ' The AllLocalFiles property gets or sets the permitted access to all local files.
- '
- Private Function AllFilesDemo() As Boolean
- Try
- Console.WriteLine("********************************************************" & ControlChars.Lf)
-
- Dim fileIOPerm1 As FileIOPermission
- Console.WriteLine("Creating a FileIOPermission and adding read access for all files")
- fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\Examples\Test\TestFile.txt")
- fileIOPerm1.AllFiles = FileIOPermissionAccess.Read
- Console.WriteLine("AllFiles access = " & fileIOPerm1.AllFiles.ToString())
- Console.WriteLine("Adding AllAccess rights for local files.")
- fileIOPerm1.AllLocalFiles = FileIOPermissionAccess.AllAccess
- Console.WriteLine("AllLocalFiles access = " & fileIOPerm1.AllLocalFiles.ToString())
-
- Catch e As ArgumentException
- Console.WriteLine(e.ToString())
- Return False
- End Try
-
- Return True
- End Function 'AllFilesDemo
- '
-
- ' Invoke all demos.
- Public Function RunDemo() As Boolean
-
- Dim ret As Boolean = True
- Dim retTmp As Boolean
- ' Call the IsSubsetOfPath demo.
- retTmp = IsSubsetOfDemo()
- If retTmp Then
- Console.Out.WriteLine("IsSubsetOf demo completed successfully.")
- Else
- Console.Out.WriteLine("IsSubsetOf demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the Union demo.
- retTmp = UnionDemo()
- If retTmp Then
- Console.Out.WriteLine("Union demo completed successfully.")
- Else
- Console.Out.WriteLine("Union demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the Intersect demo.
- retTmp = IntersectDemo()
- If retTmp Then
- Console.Out.WriteLine("Intersect demo completed successfully.")
- Else
- Console.Out.WriteLine("Intersect demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call the Copy demo.
- retTmp = CopyDemo()
- If retTmp Then
- Console.Out.WriteLine("Copy demo completed successfully.")
- Else
- Console.Out.WriteLine("Copy demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the ToFromXml demo.
- retTmp = ToFromXmlDemo()
- If retTmp Then
- Console.Out.WriteLine("ToFromXml demo completed successfully.")
- Else
- Console.Out.WriteLine("ToFromXml demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the SetGetPathList demo.
- retTmp = SetGetPathListDemo()
- If retTmp Then
- Console.Out.WriteLine("SetGetPathList demo completed successfully.")
- Else
- Console.Out.WriteLine("SetGetPathList demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the AllFiles demo.
- retTmp = AllFilesDemo()
- If retTmp Then
- Console.Out.WriteLine("AllFiles demo completed successfully.")
- Else
- Console.Out.WriteLine("AllFiles demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- Return ret
- End Function 'RunDemo
-
- ' Test harness.
- Public Overloads Shared Sub Main(ByVal args() As [String])
- Try
- Dim democase As New FileIOPermissionDemo()
- Dim ret As Boolean = democase.RunDemo()
- If ret Then
- Console.Out.WriteLine("FileIOPermission demo completed successfully.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 100
- Else
- Console.Out.WriteLine("FileIOPermission demo failed.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End If
- Catch e As Exception
- Console.Out.WriteLine("FileIOPermission demo failed")
- Console.WriteLine(e.ToString())
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End Try
- End Sub
-End Class
-
-
-' This class generates FileIOPermission objects.
-
-Friend Class FileIOGenerator
-
-
- Private myFile As String() = {"C:\Examples\Test\TestFile.txt", "C:\Examples\Test\", "C:\Examples\Test\..", "C:\Temp"}
-
- Private myAccess As FileIOPermissionAccess() = {FileIOPermissionAccess.AllAccess, FileIOPermissionAccess.Append, FileIOPermissionAccess.NoAccess, FileIOPermissionAccess.PathDiscovery, FileIOPermissionAccess.Read, FileIOPermissionAccess.Write}
-
- Private fileIndex As Integer = 0
-
-
- Public Sub New()
-
- ResetIndex()
- End Sub
-
-
- Public Sub ResetIndex()
- fileIndex = 0
- End Sub
-
- ' Create a file path.
- '
- Public Function CreateFilePath(ByRef file As String) As Boolean
-
- If fileIndex = myFile.Length Then
- file = ""
- fileIndex &= 1
- Return True
- End If
- If fileIndex > myFile.Length Then
- file = ""
- Return False
- End If
-
- file = myFile(fileIndex)
- fileIndex = fileIndex + 1
-
- Try
- Return True
- Catch e As Exception
- Console.WriteLine(("Cannot create FileIOPermission: " & file & " " & e.ToString()))
- file = ""
- Return True
- End Try
- End Function
- '
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/remarks.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/remarks.vb
deleted file mode 100644
index c2bbdcddc02..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/VB/remarks.vb
+++ /dev/null
@@ -1,87 +0,0 @@
-
-Imports System.Security
-Imports System.Security.Permissions
-
-Public Class FileIOPermissionDemo
- Public Shared Sub Main()
- Try
- Dim fileIOPerm1 as New FileIOPermission(PermissionState.Unrestricted)
-
- ' Tests for: SetPathList(FileIOPermissionAccess,String)
-
- ' Test the Read list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\\documents")
-
- Console.WriteLine("Read access before SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine(" " + path)
- Next path
-
- '
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, "C:\\temp")
- '
-
- Console.WriteLine("Read access after SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine(" " + path)
- Next path
-
-
- ' Test the Write list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, "C:\\temp")
-
- Console.WriteLine("Write access before SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Write)
- Console.WriteLine(" " + path)
- Next path
-
- '
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, "C:\\documents")
- '
-
- Console.WriteLine("Write access after SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Write)
- Console.WriteLine(" " + path)
- Next path
-
- ' Tests for: SetPathList(FileIOPermissionAccess,String[])
-
- ' Test the Read list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, New String() {"C:\\pictures", "C:\\music"})
-
- Console.WriteLine("Read access before SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine(" " + path)
- Next path
-
- '
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Read, New String() {"C:\\temp", "C:\\Documents"})
- '
-
- Console.WriteLine("Read access after SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Read)
- Console.WriteLine(" " + path)
- Next path
-
-
- ' Test the Write list
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, New String() {"C:\\temp", "C:\\Documents"})
-
- Console.WriteLine("Write access before SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Write)
- Console.WriteLine(" " + path)
- Next path
- '
- fileIOPerm1.SetPathList(FileIOPermissionAccess.Write, New String() {"C:\\pictures", "C:\\music"})
- '
-
- Console.WriteLine("Write access after SetPathList = ")
- For Each path In fileIOPerm1.GetPathList(FileIOPermissionAccess.Write)
- Console.WriteLine(" " + path)
- Next path
-
- Catch ex As Exception
- Console.WriteLine(ex.Message)
- End Try
- End Sub
-End Class
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/VB/fileiopermissionattribute.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/VB/fileiopermissionattribute.vb
deleted file mode 100644
index 0178540000a..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/VB/fileiopermissionattribute.vb
+++ /dev/null
@@ -1,84 +0,0 @@
-'
-' This sample demonstrates the use of the FileIOPermissionAttribute class.
-' The sample follows the recommended procedure of first granting PermitOnly permissions,
-' then using a Deny on that set of granted permissions.
-Imports System.Reflection
-Imports System.Security.Permissions
-Imports System.Security
-Imports System.IO
-
-Class [MyClass]
-
-
- ' This method demonstrates the use of the FileIOPermissionAttribute to create a PermitOnly permission.
- '
- '
- '
- '
- '
- '
- ' Set the Read, PathDiscovery, Append, Write, and All properties.
- _
- Public Shared Sub PermitOnlyMethod()
- '
- '
- '
- '
- '
- Console.WriteLine("Executing PermitOnlyMethod.")
- Console.WriteLine("PermitOnly the Read permission for drive C.")
- Console.WriteLine("PermitOnly the PathDiscovery permission for " & ControlChars.Lf & ControlChars.Tab & "C:\Documents and Settings\All Users.")
- Console.WriteLine("PermitOnly the Append permission for " & ControlChars.Lf & ControlChars.Tab & "C:\Documents and Settings\All Users\Application Data.")
- Console.WriteLine("PermitOnly the Write permission for " & ControlChars.Lf & ControlChars.Tab & "C:\Documents and Settings\All Users\Application Data\Microsoft.")
- Console.WriteLine("PermitOnly the All permission for " & ControlChars.Lf & ControlChars.Tab & "C:\Documents and Settings\All Users\Application Data\Microsoft\Network.")
-
- PermitOnlyTestMethod()
- End Sub
- '
-
-
- Public Shared Sub PermitOnlyTestMethod()
- Console.WriteLine("Executing PermitOnlyTestMethod.")
- Try
- Dim ps As New PermissionSet(PermissionState.None)
- ps.AddPermission(New FileIOPermission(FileIOPermissionAccess.Write, "C:\Documents and Settings\All Users\Application Data\Microsoft\Network\SomeFile"))
- Console.WriteLine(("Demanding permission to write " & "'C:\Documents and Settings\All Users\Application Data\Microsoft\Network\SomeFile'"))
- ps.Demand()
- Console.WriteLine("Demand succeeded.")
- ps.AddPermission(New FileIOPermission(FileIOPermissionAccess.Write, "C:\"))
- Console.WriteLine("Demanding permission to write to drive C.")
-
- ' This demand should cause an exception.
- ps.Demand()
- ' The TestFailed method is called if an exception is not thrown.
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("An exception was thrown because of a write demand: " & e.Message))
- End Try
- End Sub
-
-
- Public Shared Sub TestFailed()
- Console.WriteLine("Executing TestFailed.")
- Console.WriteLine("Throwing an exception.")
- Throw New Exception()
- End Sub
-
- Overloads Shared Sub Main(ByVal args() As String)
- Try
- PermitOnlyMethod()
- Catch e As Exception
- Console.WriteLine(e.Message.ToString())
- End Try
- End Sub
-End Class
-
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/VB/gacidentitypermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/VB/gacidentitypermission.vb
deleted file mode 100644
index ff70437a2f0..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/VB/gacidentitypermission.vb
+++ /dev/null
@@ -1,214 +0,0 @@
-'
-Imports System.Security
-Imports System.Security.Permissions
-
-Public Class GacIdentityPermissionDemo
-
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Function IsSubsetOfDemo() As Boolean
- Try
- '
- Dim Gac1 As New GacIdentityPermission
- Dim Gac2 As New GacIdentityPermission(PermissionState.None)
- If (Gac1.Equals(Gac2)) Then
- Console.WriteLine("GacIdentityPermission() equals GacIdentityPermission(PermissionState.None).")
- End If
- '
- If Gac1.IsSubsetOf(Gac2) Then
- Console.WriteLine((Gac1.ToString() & " is a subset of " & Gac2.ToString()))
- Else
- Console.WriteLine((Gac1.ToString() & " is not a subset of " & Gac2.ToString()))
- End If
- Catch e As Exception
- Console.WriteLine(("An exception was thrown : " & e.ToString().ToString()))
- Return False
- End Try
- Return True
- End Function 'IsSubsetOfDemo
-
- '
- '
- ' Union creates a new permission that is the union of the current permission
- ' and the specified permission.
- Private Function UnionDemo() As Boolean
- '
- Dim Gac1 As New GacIdentityPermission(PermissionState.None)
- '
- '
- Dim Gac2 As New GacIdentityPermission
- '
- Try
- Dim p3 As GacIdentityPermission = CType(Gac1.Union(Gac2), GacIdentityPermission)
-
- If Not (p3 Is Nothing) Then
- Console.WriteLine("The union of two GacIdentityPermissions was successful.")
-
- Else
- Console.WriteLine("The union of two GacIdentityPermissions failed.")
- Return False
- End If
- Catch e As Exception
- Console.WriteLine(("An exception was thrown : " & e.ToString()))
- Return False
- End Try
-
- Return True
- End Function 'UnionDemo
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the
- ' current permission and the specified permission.
- Private Function IntersectDemo() As Boolean
- Dim Gac1 As New GacIdentityPermission
- Dim Gac2 As New GacIdentityPermission
- Try
- Dim p3 As GacIdentityPermission = CType(Gac1.Intersect(Gac2), GacIdentityPermission)
- If Not (p3 Is Nothing) Then
- Console.WriteLine(("The intersection of the two permissions = " & p3.ToString() & ControlChars.Lf))
-
- Else
- Console.WriteLine("The intersection of the two permissions is null." & ControlChars.Lf)
- End If
- Catch e As Exception
- Console.WriteLine(("An exception was thrown : " & e.ToString()))
- Return False
- End Try
-
- Return True
- End Function 'IntersectDemo
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Function CopyDemo() As Boolean
-
- Dim Gac1 As New GacIdentityPermission
- Dim Gac2 As New GacIdentityPermission
- Console.WriteLine("**************************************************************************")
- Try
- Gac2 = CType(Gac1.Copy(), GacIdentityPermission)
- If Not (Gac2 Is Nothing) Then
- Console.WriteLine(("Result of copy = " & Gac2.ToString() & ControlChars.Lf))
- End If
-
- Catch e As Exception
- Console.WriteLine(("Copy failed : " & Gac1.ToString() & e.ToString()))
- Return False
- End Try
-
- Return True
- End Function 'CopyDemo
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
- ' permission with the specified state from the XML encoding.
- Private Function ToFromXmlDemo() As Boolean
- Dim Gac1 As New GacIdentityPermission
- Dim Gac2 As New GacIdentityPermission
- Console.WriteLine("**************************************************************************")
- Try
- Gac2 = New GacIdentityPermission(PermissionState.None)
- Gac2.FromXml(Gac1.ToXml())
- Dim result As Boolean = Gac2.Equals(Gac1)
- If Gac2.IsSubsetOf(Gac1) AndAlso Gac1.IsSubsetOf(Gac2) Then
- Console.WriteLine(("Result of ToFromXml = " & Gac2.ToString()))
- Else
- Console.WriteLine(Gac2.ToString())
- Console.WriteLine(Gac1.ToString())
- Return False
- End If
- Catch e As Exception
- Console.WriteLine(("ToFromXml failed. " & e.ToString()))
- Return False
- End Try
-
- Return True
- End Function 'ToFromXmlDemo
-
- '
- ' Invoke all demos.
- Public Function RunDemo() As Boolean
-
- Dim returnCode As Boolean = True
- Dim tempReturnCode As Boolean
- ' Call the IsSubsetOf demo.
- tempReturnCode = IsSubsetOfDemo()
- If tempReturnCode Then
- Console.Out.WriteLine("IsSubsetOf demo completed successfully.")
- Else
- Console.Out.WriteLine("Subset demo failed.")
- End If
- returnCode = tempReturnCode AndAlso returnCode
-
- ' Call the Union demo.
- tempReturnCode = UnionDemo()
- If tempReturnCode Then
- Console.Out.WriteLine("Union demo completed successfully.")
- Else
- Console.Out.WriteLine("Union demo failed.")
- End If
- returnCode = tempReturnCode AndAlso returnCode
-
- ' Call the Intersect demo.
- tempReturnCode = IntersectDemo()
- If tempReturnCode Then
- Console.Out.WriteLine("Intersect demo completed successfully.")
- Else
- Console.Out.WriteLine("Intersect demo failed.")
- End If
- returnCode = tempReturnCode AndAlso returnCode
-
-
- ' Call the Copy demo.
- tempReturnCode = CopyDemo()
- If tempReturnCode Then
- Console.Out.WriteLine("Copy demo completed successfully.")
- Else
- Console.Out.WriteLine("Copy demo failed.")
- End If
- returnCode = tempReturnCode AndAlso returnCode
-
- ' Call the ToFromXML demo.
- tempReturnCode = ToFromXmlDemo()
- If tempReturnCode Then
- Console.Out.WriteLine("ToFromXML demo completed successfully.")
- Else
- Console.Out.WriteLine("ToFromXml demo failed.")
- End If
- returnCode = tempReturnCode AndAlso returnCode
-
- Return returnCode
- End Function 'RunDemo
-
- ' Test harness.
- Public Overloads Shared Sub Main(ByVal args() As [String])
- Try
- Dim testcase As New GACIdentityPermissionDemo
- Dim returnCode As Boolean = testcase.RunDemo()
- If returnCode Then
- Console.Out.WriteLine("The GacIdentityPermission demo completed successfully.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 100
- Else
- Console.Out.WriteLine("The GacIdentityPermission demo failed.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End If
- Catch e As Exception
- Console.Out.WriteLine("The GacIdentityPermission demo failed.")
- Console.WriteLine(e.ToString())
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End Try
- End Sub
-End Class
-
-
-
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/VB/gacidentitypermissionattribute.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/VB/gacidentitypermissionattribute.vb
deleted file mode 100644
index bd335bbca31..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/VB/gacidentitypermissionattribute.vb
+++ /dev/null
@@ -1,40 +0,0 @@
-'
-' To run this sample you must create a strong-name key named snkey.snk
-' using the Strong Name tool (sn.exe). Both the library assembly and the
-' application assembly that calls it must be signed with that key.
-' To run successfully, the application assembly must be in the global
-' assembly cache.
-' This console application can be created using the following code.
-
-'Imports System.Security
-'Imports System.Security.Policy
-'Imports System.Security.Principal
-'Imports System.Security.Permissions
-'Imports ClassLibraryVB
-
-'Class [MyClass]
-'
-' Overloads Shared Sub Main(ByVal args() As String)
-' Try
-' Dim myLib As New Class1
-' myLib.DoNothing()
-'
-' Console.WriteLine("Exiting the sample.")
-' Catch e As Exception
-' Console.WriteLine(e.Message)
-' End Try
-' End Sub
-'End Class
-Imports System.Security.Permissions
-
-'
-' Demand that the calling program be in the global assembly cache.
- _
-Public Class Class1
-'
- Public Sub DoNothing()
- Console.WriteLine("Exiting the library program.")
- End Sub
-End Class
-
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/VB/hostprotectionattribute.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/VB/hostprotectionattribute.vb
deleted file mode 100644
index 2d1b3207619..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/VB/hostprotectionattribute.vb
+++ /dev/null
@@ -1,219 +0,0 @@
-'
-Imports System.IO
-Imports System.Threading
-Imports System.Security
-Imports System.Security.Policy
-Imports System.Security.Principal
-Imports System.Security.Permissions
-Imports System.Diagnostics
-Imports System.ComponentModel
-Imports System.Windows.Forms
-
-
-' If this application is run on a server that implements host protection, the
-' HostProtectionAttribute attribute is applied. If the application is run on
-' a server that is not host-protected, the attribute evaporates; it is not
-' detected and therefore not applied. Host protection can be configured with
-' members of the HostProtectionResource enumeration to customize the
-' protection offered.
-' The primary intent of this sample is to show situations in which the
-' HostProtectionAttribute attribute might be meaningfully used. The
-' environment required to demonstrate a particular behavior is too
-' complex to invoke within the scope of this sample.
-
-Class HostProtectionExample
- Public Shared Success As Integer = 100
-
- '
- ' Use the enumeration flags to indicate that this method exposes
- ' shared state and self-affecting process management.
- ' Either of the following attribute statements can be used to set the
- ' resource flags.
- _
- Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)
-
- ' Exit the sample when an exception is thrown.
- Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
- Code.ToString()))
- Environment.ExitCode = Code
- Environment.Exit(Code)
- End Sub
- '
-
- '
- ' Use the enumeration flags to indicate that this method exposes shared
- ' state, self-affecting process management, and self-affecting threading.
- _
- Private Shared Sub ExecuteBreak()
-
- ' This method allows the user to quit the sample.
- Console.WriteLine("Executing Debugger.Break.")
- Debugger.Break()
- Debugger.Log(1, "info", "test message")
- End Sub
- '
-
- '
- ' Use the enumeration flags to indicate that this method exposes shared
- ' state, self-affecting threading, and the security infrastructure.
- _
- Private Shared Function ApplyIdentity() As Integer
-
- ' ApplyIdentity sets the current identity.
- Dim roles(1) As String
- Try
- Dim mAD As AppDomain = AppDomain.CurrentDomain
- Dim mGenPr As _
- New GenericPrincipal(WindowsIdentity.GetCurrent(), roles)
- mAD.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
- mAD.SetThreadPrincipal(mGenPr)
- Return Success
- Catch e As Exception
- [Exit](e.ToString(), 5)
- End Try
- Return 0
- End Function 'ApplyIdentity
- '
-
- ' The following method is started on a separate thread.
- Public Shared Sub WatchFileEvents()
- Try
- Console.WriteLine("In the child thread.")
- Dim watcher As New FileSystemWatcher()
- watcher.Path = "C:\Temp"
-
- ' Watch for changes in LastAccess and LastWrite times, and
- ' name changes to files or directories.
- watcher.NotifyFilter = NotifyFilters.LastAccess Or _
- NotifyFilters.LastWrite Or NotifyFilters.FileName Or _
- NotifyFilters.DirectoryName
-
- ' Watch only text files.
- watcher.Filter = "*.txt"
-
- ' Add event handlers.
- AddHandler watcher.Changed, AddressOf OnChanged
- AddHandler watcher.Created, AddressOf OnChanged
- AddHandler watcher.Deleted, AddressOf OnChanged
-
- ' Begin watching.
- watcher.EnableRaisingEvents = True
-
- ' Wait for the user to quit the program.
- Console.WriteLine("Event handlers have been enabled.")
- While Console.ReadLine() <> "q"c
- End While
- Catch e As Exception
- Console.WriteLine(e.Message)
- End Try
- End Sub
-
- '
- ' Use the enumeration flags to indicate that this method exposes
- ' synchronization and external threading.
- _
- Private Shared Sub StartThread()
- Dim t As New Thread(New ThreadStart(AddressOf WatchFileEvents))
-
- ' Start the new thread. On a uniprocessor, the thread is not given
- ' any processor time until the main thread yields the processor.
- t.Start()
-
- ' Give the new thread a chance to execute.
- Thread.Sleep(1000)
- End Sub
- '
-
- ' Call methods that show the use of the HostProtectionResource enumeration.
- _
- Overloads Shared Function Main(ByVal args() As String) As Integer
- Try
- ' Show use of the HostProtectionResource.SharedState,
- ' HostProtectionResource.SelfAffectingThreading, and
- ' HostProtectionResource.Security enumeration values.
- ApplyIdentity()
- Directory.CreateDirectory("C:\Temp")
-
- ' Show use of the HostProtectionResource.Synchronization and
- ' HostProtectionResource.ExternalThreading enumeration values.
- StartThread()
- Console.WriteLine("In the main thread.")
- Console.WriteLine("Deleting and creating 'MyTestFile.txt'.")
- If File.Exists("C:\Temp\MyTestFile.txt") Then
- File.Delete("C:\Temp\MyTestFile.txt")
- End If
-
- Dim sr As StreamWriter = File.CreateText("C:\Temp\MyTestFile.txt")
- sr.WriteLine("This is my file.")
- sr.Close()
- Thread.Sleep(1000)
-
- ' Show use of the HostProtectionResource.SharedState,
- ' HostProtectionResource.SelfProcessMgmt,
- ' HostProtectionResource.SelfAffectingThreading, and
- ' HostProtectionResource.UI enumeration values.
- ExecuteBreak()
-
- ' Show the use of the
- ' HostProtectionResource.ExternalProcessManagement
- ' enumeration value.
- Dim myControl As New MyControl()
- Console.WriteLine("Enter 'q' to quit the sample.")
- Return 100
- Catch e As Exception
- [Exit](e.ToString(), 0)
- Return 0
- End Try
- End Function 'Main
-
- ' Define the event handlers.
- Private Shared Sub OnChanged(ByVal [source] As Object, _
- ByVal e As FileSystemEventArgs)
-
- ' Specify whether a file is changed, created, or deleted.
- Console.WriteLine("In the OnChanged event handler.")
- Console.WriteLine(("File: " & e.FullPath & " " & _
- e.ChangeType.ToString()))
- End Sub
-End Class
-
-'
-' The following class is an example of code that exposes
-' external process management.
-' Add the LicenseProviderAttribute to the control.
- _
-Public Class MyControl
- Inherits System.Windows.Forms.Control
-
- ' Create a new, null license.
- Private license As License = Nothing
-
- _
- Public Sub New()
-
- ' Determine if a valid license can be granted.
- Dim isValid As Boolean = LicenseManager.IsValid(GetType(MyControl))
- Console.WriteLine(("The result of the IsValid method call is " & _
- isValid.ToString()))
- End Sub
-
- Protected Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (license Is Nothing) Then
- license.Dispose()
- license = Nothing
- End If
- End If
- End Sub
-End Class
-'
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/VB/Form1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/VB/Form1.vb
deleted file mode 100644
index 20fc1171561..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/VB/Form1.vb
+++ /dev/null
@@ -1,270 +0,0 @@
-'
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Security.Cryptography
-
-
-
-Public Class KeyContainerPermissionDemo
- Private Shared cspParams As New CspParameters()
- Private Shared rsa As New RSACryptoServiceProvider()
- Private Shared providerName As String
- Private Shared providerType As Integer
- Private Shared myKeyContainerName As String
- ' Create three KeyContainerPermissionAccessEntry objects, each with a different constructor.
- '
- Private Shared keyContainerPermAccEntry1 As _
- New KeyContainerPermissionAccessEntry("MyKeyContainer", KeyContainerPermissionFlags.Create)
- '
- '
- Private Shared keyContainerPermAccEntry2 As _
- New KeyContainerPermissionAccessEntry(cspParams, KeyContainerPermissionFlags.Open)
- '
- '
- Private Shared keyContainerPermAccEntry3 As _
- New KeyContainerPermissionAccessEntry("Machine", providerName, providerType, _
- myKeyContainerName, 1, KeyContainerPermissionFlags.Open)
-
- '
-
- Public Shared Function Main() As Integer
- Try
- ' Create a key container for use in the sample.
- GenKey_SaveInContainer("MyKeyContainer")
- ' Initialize property values for creating a KeyContainerPermissionAccessEntry object.
- myKeyContainerName = rsa.CspKeyContainerInfo.KeyContainerName
- providerName = rsa.CspKeyContainerInfo.ProviderName
- providerType = rsa.CspKeyContainerInfo.ProviderType
- cspParams.KeyContainerName = myKeyContainerName
- cspParams.ProviderName = providerName
- cspParams.ProviderType = providerType
-
- ' Display the KeyContainerPermissionAccessEntry properties using
- ' the third KeyContainerPermissionAccessEntry object.
- DisplayAccessEntryMembers()
- '
- ' Add access entry objects to a key container permission.
- Dim keyContainerPerm1 As New KeyContainerPermission(PermissionState.Unrestricted)
- Console.WriteLine("Is the permission unrestricted? " + _
- keyContainerPerm1.IsUnrestricted().ToString())
- keyContainerPerm1.AccessEntries.Add(keyContainerPermAccEntry1)
- keyContainerPerm1.AccessEntries.Add(keyContainerPermAccEntry2)
- '
- ' Display the permission.
- System.Console.WriteLine(keyContainerPerm1.ToXml().ToString())
-
- '
- ' Create an array of KeyContainerPermissionAccessEntry objects
- Dim keyContainerPermAccEntryArray As KeyContainerPermissionAccessEntry() = _
- {keyContainerPermAccEntry1, keyContainerPermAccEntry2}
-
- ' Create a new KeyContainerPermission using the array.
- Dim keyContainerPerm2 As _
- New KeyContainerPermission(KeyContainerPermissionFlags.AllFlags, keyContainerPermAccEntryArray)
- '
- DisplayPermissionMembers(keyContainerPerm2, keyContainerPermAccEntryArray)
-
- ' Demonstrate the effect of a deny for opening a key container.
- DenyOpen()
- ' Demonstrate the deletion of a key container.
- DeleteContainer()
-
- Console.WriteLine("Press the Enter key to exit.")
- Console.Read()
- Return 0
- ' Close the current try block that did not expect an exception.
- Catch e As Exception
- Console.WriteLine("Unexpected exception thrown: " + e.Message)
- Return 0
- End Try
-
- End Function 'Main
-
-
- Private Shared Sub DisplayAccessEntryMembers()
- '
- Console.WriteLine(vbLf + "KeycontainerName is " + _
- keyContainerPermAccEntry3.KeyContainerName)
- '
- '
- Console.WriteLine("KeySpec is " + IIf(1 = keyContainerPermAccEntry3.KeySpec, _
- "AT_KEYEXCHANGE ", "AT_SIGNATURE"))
- '
- '
- Console.WriteLine("KeyStore is " + keyContainerPermAccEntry3.KeyStore)
- '
- '
- Console.WriteLine("ProviderName is " + keyContainerPermAccEntry3.ProviderName)
- '
- '
- Console.WriteLine("ProviderType is " + IIf(1 = keyContainerPermAccEntry3.ProviderType, _
- "PROV_RSA_FULL", keyContainerPermAccEntry3.ProviderType.ToString()))
- '
- '
- Console.WriteLine("Hashcode = " + keyContainerPermAccEntry3.GetHashCode().ToString())
- '
- '
- Console.WriteLine("Are the KeyContainerPermissionAccessEntry objects equal? " + _
- keyContainerPermAccEntry3.Equals(keyContainerPermAccEntry2).ToString())
-
- End Sub
- '
-
- Private Shared Sub DisplayPermissionMembers(ByVal keyContainerPermParam As _
- KeyContainerPermission, ByVal keyContainerPermAccEntryArrayParam() _
- As KeyContainerPermissionAccessEntry)
- Dim keyContainerPerm2 As KeyContainerPermission = keyContainerPermParam
- Dim keyContainerPermAccEntryArray As KeyContainerPermissionAccessEntry() = _
- keyContainerPermAccEntryArrayParam
- ' Display the KeyContainerPermission properties.
- '
- Console.WriteLine(vbLf + "Flags value is " + keyContainerPerm2.Flags.ToString())
- '
- '
- Dim keyContainerPerm3 As KeyContainerPermission = _
- CType(keyContainerPerm2.Copy(), KeyContainerPermission)
- Console.WriteLine("Is the copy equal to the original? " + _
- keyContainerPerm3.Equals(keyContainerPerm2).ToString())
- '
- '
- ' Perform an XML roundtrip.
- keyContainerPerm3.FromXml(keyContainerPerm2.ToXml())
- Console.WriteLine("Was the XML roundtrip successful? " + _
- keyContainerPerm3.Equals(keyContainerPerm2).ToString())
- '
- Dim keyContainerPerm4 As New KeyContainerPermission(KeyContainerPermissionFlags.Open, _
- keyContainerPermAccEntryArray)
- '
- Dim keyContainerPerm5 As KeyContainerPermission = _
- CType(keyContainerPerm2.Intersect(keyContainerPerm4), KeyContainerPermission)
- Console.WriteLine("Flags value after the intersection is " + _
- keyContainerPerm5.Flags.ToString())
- '
- '
- keyContainerPerm5 = CType(keyContainerPerm2.Union(keyContainerPerm4), _
- KeyContainerPermission)
- '
- '
- Console.WriteLine("Flags value after the union is " + _
- keyContainerPerm5.Flags.ToString())
- '
- '
- Console.WriteLine("Is one permission a subset of the other? " + _
- keyContainerPerm4.IsSubsetOf(keyContainerPerm2).ToString())
-
- End Sub
- '
-
- Private Shared Sub GenKey_SaveInContainer(ByVal containerName As String)
- ' Create the CspParameters object and set the key container
- ' name used to store the RSA key pair.
- cspParams = New CspParameters()
-
- cspParams.KeyContainerName = containerName
-
- ' Create a new instance of RSACryptoServiceProvider that accesses
- ' the key container identified by the containerName parameter.
- rsa = New RSACryptoServiceProvider(cspParams)
-
- ' Display the key information to the console.
- Console.WriteLine(vbLf + "Key added to container: " + vbLf + " {0}", _
- rsa.ToXmlString(True))
-
- End Sub
-
- Private Shared Sub GetKeyFromContainer(ByVal containerName As String)
- Try
- cspParams = New CspParameters()
- cspParams.KeyContainerName = containerName
-
- ' Create a new instance of RSACryptoServiceProvider that accesses
- ' the key container identified by the containerName parameter.
- ' If the key container does not exist, a new one is created.
- rsa = New RSACryptoServiceProvider(cspParams)
-
- ' Use the rsa object to access the key.
- ' Display the key information to the console.
- Console.WriteLine(vbLf + "Key retrieved from container : " + _
- vbLf + " {0}", rsa.ToXmlString(True))
- Console.WriteLine("KeycontainerName is " + rsa.CspKeyContainerInfo.KeyContainerName)
- Console.WriteLine("ProviderName is " + rsa.CspKeyContainerInfo.ProviderName)
- Console.WriteLine("ProviderType is " + IIf(1 = _
- rsa.CspKeyContainerInfo.ProviderType, "PROV_RSA_FULL", _
- rsa.CspKeyContainerInfo.ProviderType.ToString()))
- Catch e As Exception
- Console.WriteLine("Exception thrown: " + e.Message)
- End Try
-
- End Sub
-
- Private Shared Sub DeleteKeyContainer(ByVal containerName As String)
- ' Create the CspParameters object and set the key container
- ' name used to store the RSA key pair.
- cspParams = New CspParameters()
- cspParams.KeyContainerName = containerName
-
- ' Create a new instance of RSACryptoServiceProvider that accesses
- ' the key container.
- rsa = New RSACryptoServiceProvider(cspParams)
-
- ' Do not persist the key entry, effectively deleting the key.
- rsa.PersistKeyInCsp = False
-
- ' Call Clear to release the key container resources.
- rsa.Clear()
- Console.WriteLine(vbLf + "Key container released.")
-
- End Sub
-
- Private Shared Sub DenyOpen()
- Try
- '
- ' Create a KeyContainerPermission with the right to open the key container.
- Dim keyContainerPerm As New KeyContainerPermission(KeyContainerPermissionFlags.Open)
-
- '
- ' Demonstrate the results of a deny for an open action.
- keyContainerPerm.Deny()
-
- ' The next line causes an exception to be thrown when the infrastructure code attempts
- ' to open the key container.
- Dim info As New CspKeyContainerInfo(cspParams)
- Catch e As Exception
- Console.WriteLine("Expected exception thrown: " + e.Message)
- End Try
-
- ' Revert the deny.
- CodeAccessPermission.RevertDeny()
-
- End Sub
-
- Private Shared Sub DeleteContainer()
- Try
- ' Create a KeyContainerPermission with the right to create a key container.
- Dim keyContainerPerm As New KeyContainerPermission(KeyContainerPermissionFlags.Create)
-
- ' Deny the ability to create a key container.
- ' This deny is used to show the key container has been successfully deleted.
- keyContainerPerm.Deny()
-
- ' Retrieve the key from the container.
- ' This code executes successfully because the key container already exists.
- ' The deny for permission to create a key container does not affect this method call.
- GetKeyFromContainer("MyKeyContainer")
-
- ' Delete the key and the container.
- DeleteKeyContainer("MyKeyContainer")
-
- ' Attempt to obtain the key from the deleted key container.
- ' This time the method call results in an exception because of
- ' an attempt to create a new key container.
- Console.WriteLine(vbLf + _
- "Attempt to create a new key container with create permission denied.")
- GetKeyFromContainer("MyKeyContainer")
- Catch e As CryptographicException
- Console.WriteLine("Expected exception thrown: " + e.Message)
- End Try
-
- End Sub
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/VB/nameidpermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/VB/nameidpermission.vb
deleted file mode 100644
index 352c67051d7..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/VB/nameidpermission.vb
+++ /dev/null
@@ -1,217 +0,0 @@
-#Const debug = True
-'
-' This custom permission is intended only for the purposes of illustration.
-' The following code shows how to create a custom permission that inherits
-' from CodeAccessPermission. The code implements all required overrides.
-' A wildcard character ('*') is implemented for the Name property.
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.IO
-Imports System.Security.Policy
-Imports System.Collections
-
-
-
-
-Namespace MyPermission
-
- _
- Public NotInheritable Class NameIdPermission
- Inherits CodeAccessPermission
- Implements IUnrestrictedPermission
- Private m_Name As String
- Private m_Unrestricted As Boolean
-
-
- Public Sub New(ByVal name As String)
- m_name = name
- End Sub
-
-
- Public Sub New(ByVal state As PermissionState)
- If state = PermissionState.None Then
- m_name = ""
- ElseIf state = PermissionState.Unrestricted Then
- Throw New ArgumentException("Unrestricted state is not allowed for identity permissions.")
- Else
- Throw New ArgumentException("Invalid permission state.")
- End If
- End Sub
-
- Public Property Name() As String
- Get
- Return m_name
- End Get
- Set(ByVal Value As String)
- m_name = Value
- End Set
- End Property
-
- '
- Public Overrides Function Copy() As IPermission
- Dim name As String
- name = m_name
- Return New NameIdPermission(name)
- End Function 'Copy
-
- '
- '
- Public Function IsUnrestricted() As Boolean Implements IUnrestrictedPermission.IsUnrestricted
- ' Always false, unrestricted state is not allowed.
- Return m_Unrestricted
- End Function
- '
- Private Function VerifyType(ByVal target As IPermission) As Boolean
- Return TypeOf target Is NameIdPermission
- End Function 'VerifyType
-
- '
- Public Overrides Function IsSubsetOf(ByVal target As IPermission) As Boolean
-
-#If (Debug) Then
-
- Console.WriteLine("************* Entering IsSubsetOf *********************")
-#End If
- If target Is Nothing Then
- Console.WriteLine("IsSubsetOf: target == null")
- Return False
- End If
-#If (Debug) Then
- Console.WriteLine(("This is = " + CType(Me, NameIdPermission).Name))
- Console.WriteLine(("Target is " + CType(target, NameIdPermission).m_name))
-#End If
- Try
- Dim operand As NameIdPermission = CType(target, NameIdPermission)
-
- ' The following check for unrestricted permission is only included as an example for
- ' permissions that allow the unrestricted state. It is of no value for this permission.
- If True = operand.m_Unrestricted Then
- Return True
- ElseIf True = Me.m_Unrestricted Then
- Return False
- End If
-
- If Not (Me.m_name Is Nothing) Then
- If operand.m_name Is Nothing Then
- Return False
- End If
- If Me.m_name = "" Then
- Return True
- End If
- End If
- If Me.m_name.Equals(operand.m_name) Then
- Return True
- Else
- ' Check for wild card character '*'.
- Dim i As Integer = operand.m_name.LastIndexOf("*")
-
- If i > 0 Then
- Dim prefix As String = operand.m_name.Substring(0, i)
-
- If Me.m_name.StartsWith(prefix) Then
- Return True
- End If
- End If
- End If
-
- Return False
- Catch
- Throw New ArgumentException(String.Format("Argument_WrongType", Me.GetType().FullName))
- End Try
- End Function
-
- '
- '
- Public Overrides Function Intersect(ByVal target As IPermission) As IPermission
- Console.WriteLine("************* Entering Intersect *********************")
- If target Is Nothing Then
- Return Nothing
- End If
-#If (Debug) Then
-
- Console.WriteLine(("This is = " + CType(Me, NameIdPermission).Name))
- Console.WriteLine(("Target is " + CType(target, NameIdPermission).m_name))
-#End If
- If Not VerifyType(target) Then
- Throw New ArgumentException(String.Format("Argument is wrong type.", Me.GetType().FullName))
- End If
-
- Dim operand As NameIdPermission = CType(target, NameIdPermission)
-
- If operand.IsSubsetOf(Me) Then
- Return operand.Copy()
- ElseIf Me.IsSubsetOf(operand) Then
- Return Me.Copy()
- Else
- Return Nothing
- End If
- End Function 'Intersect
- '
-
- '
- Public Overrides Function Union(ByVal target As IPermission) As IPermission
-#If (Debug) Then
-
- Console.WriteLine("************* Entering Union *********************")
-#End If
- If target Is Nothing Then
- Return Me
- End If
-#If (Debug) Then
- Console.WriteLine(("This is = " + CType(Me, NameIdPermission).Name))
- Console.WriteLine(("Target is " + CType(target, NameIdPermission).m_name))
-#End If
- If Not VerifyType(target) Then
- Throw New ArgumentException(String.Format("Argument_WrongType", Me.GetType().FullName))
- End If
-
- Dim operand As NameIdPermission = CType(target, NameIdPermission)
-
- If operand.IsSubsetOf(Me) Then
- Return Me.Copy()
- ElseIf Me.IsSubsetOf(operand) Then
- Return operand.Copy()
- Else
- Return Nothing
- End If
- End Function 'Union
- '
-
- '
- Public Overrides Sub FromXml(ByVal e As SecurityElement)
- ' The following code for unrestricted permission is only included as an example for
- ' permissions that allow the unrestricted state. It is of no value for this permission.
- Dim elUnrestricted As String = e.Attribute("Unrestricted")
- If Nothing <> elUnrestricted Then
- m_Unrestricted = Boolean.Parse(elUnrestricted)
- Return
- End If
-
- Dim elName As String = e.Attribute("Name")
- m_name = IIf(elName Is Nothing, Nothing, elName)
- End Sub
-
- '
- '
- Public Overrides Function ToXml() As SecurityElement
- ' Use the SecurityElement class to encode the permission to XML.
- Dim esd As New SecurityElement("IPermission")
-
- Dim name As String = GetType(NameIdPermission).AssemblyQualifiedName
- esd.AddAttribute("class", name)
- esd.AddAttribute("version", "1.0")
-
- ' The following code for unrestricted permission is only included as an example for
- ' permissions that allow the unrestricted state. It is of no value for this permission.
- If m_Unrestricted Then
- esd.AddAttribute("Unrestricted", True.ToString())
- End If
- If Not (m_Name Is Nothing) Then
- esd.AddAttribute("Name", m_Name)
- End If
- Return esd
- End Function 'ToXml
- End Class
- '
-End Namespace
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PermissionSetAttribute/VB/Form1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PermissionSetAttribute/VB/Form1.vb
deleted file mode 100644
index 38179922142..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PermissionSetAttribute/VB/Form1.vb
+++ /dev/null
@@ -1,319 +0,0 @@
-'
-' The #Const BuildFile = True statement must be active the first time this
-' sample is run. This causes the sample to create a file named
-' 'LocalIntranet.xml' in the c:\temp folder. After creating the
-' LocalInternet.xml file, comment out the #Const BUILDFILE = True statement,
-' uncomment the #Const BUILDFILE = False statement, and rerun the sample to
-' demonstrate the use of the permission set attribute.
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Security.Policy
-Imports System.Collections
-Imports System.IO
-
-#Const BUILDFILE = True
-'#Const BUILDFILE = False
-
-Public Class Form1
- Inherits System.Windows.Forms.Form
-
- ' Event handler for Run button.
- _
- Private Sub Button1_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button1.Click
-
- tbxOutput.Cursor = Cursors.WaitCursor
- tbxOutput.Text = ""
-
- Dim xmlFilePath As String
- xmlFilePath = "c:\temp\LocalIntranet.xml"
-
- ' Run this sample with the BuildFile symbol defined to create the
- ' required file, then comment out the /define statement to demonstrate
- ' the use of the attribute.
-#If (BUILDFILE) Then
- Dim sw As New StreamWriter(xmlFilePath)
- Try
- sw.WriteLine(GetNamedPermissionSet("LocalIntranet"))
- WriteLine("File created at " + xmlFilePath)
- WriteLine("Uncomment the BuildFile=false line and " + _
- "run the sample again.")
- Finally
- sw.Close()
- End Try
-#End If
-
-#If (Not BUILDFILE) Then
- ReadFile1()
- ReadFile2()
- ReadFile3()
-#End If
- ' Align interface and conclude application.
- WriteLine(vbCrLf + "This sample completed successfully;" + _
- " press Exit to continue.")
-
- ' Reset the cursor.
- tbxOutput.Cursor = Cursors.Default
- End Sub
-
-#If (Not BUILDFILE) Then
- ' Read the LocalIntranet.xml file.
- Private Sub ReadFile1()
- Try
- WriteLine("Attempting to read a file using the FullTrust " + _
- "permission set.")
- Dim sr As New StreamReader("c:\temp\LocalIntranet.xml")
- Try
- Dim permissionSet As String = sr.ReadToEnd()
- Finally
- sr.Close()
- End Try
- WriteLine("The file was successfully read.")
- Catch e As Exception
- WriteLine(e.Message)
- End Try
- End Sub
-
- '
- _
- Private Sub ReadFile2()
- '
- ' Read the file with the specified security action on the file path.
- Try
- WriteLine("Attempting to read a file using the LocalIntranet " + _
- "permission set.")
- Dim sr As New StreamReader("c:\temp\LocalIntranet.xml")
- Try
- Dim permissionSet As String = sr.ReadToEnd()
- Finally
- sr.Close()
- End Try
- WriteLine("The file was successfully read.")
- Catch e As Exception
- WriteLine(e.Message)
- End Try
- End Sub
-
- '
- _
- Private Sub ReadFile3()
- '
- ' Read the file with the specified security action on the
- ' permission set.
- Try
- WriteLine("Second attempt to read a file using the " + _
- "LocalIntranet permission set.")
- Dim sr As New StreamReader("c:\temp\LocalIntranet.xml")
- Try
- Dim permissionSet As String = sr.ReadToEnd()
- Finally
- sr.Close()
- End Try
- WriteLine("The file was successfully read.")
- Catch e As Exception
- WriteLine(e.Message)
- End Try
- End Sub
-#End If
-
- ' Locate the named permission set at the Machine level and return it as
- ' a string value.
- Private Shared Function GetNamedPermissionSet( _
- ByVal name As String) As String
-
- Dim policyEnumerator As IEnumerator
- policyEnumerator = SecurityManager.PolicyHierarchy()
-
- ' Move through the policy levels to the Machine Level.
- While policyEnumerator.MoveNext()
- Dim currentLevel As PolicyLevel
- currentLevel = CType(policyEnumerator.Current, PolicyLevel)
- If currentLevel.Label = "Machine" Then
- ' Iterate through the permission sets at the Machine level.
- Dim namedPermissions As IList
- namedPermissions = currentLevel.NamedPermissionSets
-
- Dim namedPermission As IEnumerator
- namedPermission = namedPermissions.GetEnumerator()
-
- Dim currentPermission As NamedPermissionSet
- ' Locate the named permission set.
- While namedPermission.MoveNext()
- currentPermission = CType( _
- namedPermission.Current, _
- NamedPermissionSet)
-
- If currentPermission.Name.Equals(name) Then
- Return currentPermission.ToString()
- End If
- End While
- End If
- End While
- Return Nothing
- End Function
-
- ' Write specified message and carriage return to the output textbox.
- Private Sub WriteLine(ByVal message As String)
- tbxOutput.AppendText(message + vbCrLf)
-
- End Sub
-
- ' Event handler for Exit button.
- Private Sub Button2_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button2.Click
-
- Application.Exit()
- End Sub
-#Region " Windows Form Designer generated code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
-
- 'Add any initialization after the InitializeComponent() call
-
- End Sub
-
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
-
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
-
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents Panel2 As System.Windows.Forms.Panel
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents tbxOutput As System.Windows.Forms.RichTextBox
- _
- Private Sub InitializeComponent()
- Me.Panel2 = New System.Windows.Forms.Panel
- Me.Button1 = New System.Windows.Forms.Button
- Me.Button2 = New System.Windows.Forms.Button
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.tbxOutput = New System.Windows.Forms.RichTextBox
- Me.Panel2.SuspendLayout()
- Me.Panel1.SuspendLayout()
- Me.SuspendLayout()
- '
- 'Panel2
- '
- Me.Panel2.Controls.Add(Me.Button1)
- Me.Panel2.Controls.Add(Me.Button2)
- Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.Panel2.DockPadding.All = 20
- Me.Panel2.Location = New System.Drawing.Point(0, 320)
- Me.Panel2.Name = "Panel2"
- Me.Panel2.Size = New System.Drawing.Size(616, 64)
- Me.Panel2.TabIndex = 1
- '
- 'Button1
- '
- Me.Button1.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button1.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button1.Location = New System.Drawing.Point(446, 20)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(75, 24)
- Me.Button1.TabIndex = 2
- Me.Button1.Text = "&Run"
- '
- 'Button2
- '
- Me.Button2.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button2.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button2.Location = New System.Drawing.Point(521, 20)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(75, 24)
- Me.Button2.TabIndex = 3
- Me.Button2.Text = "E&xit"
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.tbxOutput)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel1.DockPadding.All = 20
- Me.Panel1.Location = New System.Drawing.Point(0, 0)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(616, 320)
- Me.Panel1.TabIndex = 2
- '
- 'tbxOutput
- '
- Me.tbxOutput.AccessibleDescription = _
- "Displays output from application."
- Me.tbxOutput.AccessibleName = "Output textbox."
- Me.tbxOutput.Dock = System.Windows.Forms.DockStyle.Fill
- Me.tbxOutput.Location = New System.Drawing.Point(20, 20)
- Me.tbxOutput.Name = "tbxOutput"
- Me.tbxOutput.Size = New System.Drawing.Size(576, 280)
- Me.tbxOutput.TabIndex = 1
- Me.tbxOutput.Text = "Click the Run button to run the application."
- '
- 'Form1
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
- Me.ClientSize = New System.Drawing.Size(616, 384)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.Panel2)
- Me.Name = "Form1"
- Me.Text = "PermisstionSetAttribute"
- Me.Panel2.ResumeLayout(False)
- Me.Panel1.ResumeLayout(False)
- Me.ResumeLayout(False)
-
- End Sub
-
-#End Region
-End Class
-'
-' This sample produces the following output:
-'
-' File created at c:\temp\LocalIntranet.xml
-' Uncomment the BuildFile=false line and run the sample again.
-'
-' This sample completed successfully; press Exit to continue.
-'
-'
-' The second time the sample is ran (without DEBUG flag):
-'
-' Attempting to read a file using the FullTrust permission set.
-' The file was successfully read.
-' Attempting to read a file using the LocalIntranet permission set.
-' Request for the permission of type
-' System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0,
-' Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
-'
-' Second attempt to read a file using the LocalIntranet permission set.
-' Request for the permission of type System.Security.Permissions.FileIOPermission,
-' mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-' failed.
-' This sample completed successfully; press Exit to continue.
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/VB/publisheridentitypermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/VB/publisheridentitypermission.vb
deleted file mode 100644
index e26f654d389..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/VB/publisheridentitypermission.vb
+++ /dev/null
@@ -1,116 +0,0 @@
-'
-' To execute this sample you will need two certification files, MyCert1.cer and MyCert2.cer.
-' The certification files can be created using the Certification Creation Tool, MakeCert.exe.
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Security.Cryptography.X509Certificates
-Imports System.IO
-
-
-
-Public Class PublisherIdentityPermissionDemo
- Private Shared publisherCertificate(1) As X509Certificate
- Private Shared publisherPerm1 As PublisherIdentityPermission
- Private Shared publisherPerm2 As PublisherIdentityPermission
-
- ' Demonstrate all methods.
- Public Shared Sub Main(ByVal args() As String)
- ' Initialize the PublisherIdentityPermissions for use in the sample
- '
- Dim fs1 As New FileStream("..\..\..\MyCert1.cer", FileMode.Open)
- Dim certSBytes1(Fix(fs1.Length)) As [Byte]
- fs1.Read(certSBytes1, 0, Fix(fs1.Length))
- publisherCertificate(0) = New X509Certificate(certSBytes1)
- fs1.Close()
- Dim fs2 As New FileStream("..\..\..\MyCert2.cer", FileMode.Open)
- Dim certSBytes2(Fix(fs2.Length)) As [Byte]
- fs2.Read(certSBytes2, 0, Fix(fs2.Length))
- publisherCertificate(1) = New X509Certificate(certSBytes2)
- fs2.Close()
-
- publisherPerm1 = New PublisherIdentityPermission(publisherCertificate(0))
- publisherPerm2 = New PublisherIdentityPermission(publisherCertificate(1))
- '
- IsSubsetOfDemo()
- CopyDemo()
- UnionDemo()
- IntersectDemo()
- ToFromXmlDemo()
-
- End Sub
-
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- '
- Private Shared Sub IsSubsetOfDemo()
-
- If publisherPerm2.IsSubsetOf(publisherPerm1) Then
- Console.WriteLine(publisherPerm2.Certificate.Subject.ToString() + _
- " is a subset of " + publisherPerm1.Certificate.Subject.ToString())
- Else
- Console.WriteLine(publisherPerm2.Certificate.Subject.ToString() + _
- " is not a subset of " + publisherPerm1.Certificate.Subject.ToString())
- End If
-
- End Sub
-
- '
- ' Union creates a new permission that is the union of the current permission and the specified permission.
- '
- Private Shared Sub UnionDemo()
- Dim publisherPerm3 As PublisherIdentityPermission = CType(publisherPerm1.Union(publisherPerm2), PublisherIdentityPermission)
- If publisherPerm3 Is Nothing Then
- Console.WriteLine("The union of " + publisherPerm1.ToString() + " and " _
- + publisherPerm2.Certificate.Subject.ToString() + " is null.")
- Else
- Console.WriteLine("The union of " + publisherPerm1.Certificate.Subject.ToString() + _
- " and " + publisherPerm2.Certificate.Subject.ToString() + " = " + _
- CType(publisherPerm3, PublisherIdentityPermission).Certificate.Subject.ToString())
- End If
-
- End Sub
-
-
- '
- ' Intersect creates and returns a new permission that is the intersection of the current
- ' permission and the permission specified.
- '
- Private Shared Sub IntersectDemo()
- Dim publisherPerm3 As PublisherIdentityPermission = CType(publisherPerm1.Union(publisherPerm2), PublisherIdentityPermission)
- If Not (publisherPerm3 Is Nothing) Then
- Console.WriteLine("The intersection of " + publisherPerm1.Certificate.Subject.ToString() + " = " + _
- CType(publisherPerm3, PublisherIdentityPermission).Certificate.Subject.ToString())
- Else
- Console.WriteLine("The intersection of " + publisherPerm1.Certificate.Subject.ToString() + _
- " and " + publisherPerm2.Certificate.Subject.ToString() + " is null.")
- End If
-
- End Sub
-
-
- '
- 'Copy creates and returns an identical copy of the current permission.
- '
- Private Shared Sub CopyDemo()
- '
- ' Create an empty PublisherIdentityPermission to serve as the target of the copy.
- publisherPerm2 = New PublisherIdentityPermission(PermissionState.None)
- publisherPerm2 = CType(publisherPerm1.Copy(), PublisherIdentityPermission)
- Console.WriteLine("Result of copy = " + publisherPerm2.ToString())
-
- End Sub
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state;
- ' FromXml reconstructs a permission with the specified state from the XML encoding.
- '
- Private Shared Sub ToFromXmlDemo()
- publisherPerm2 = New PublisherIdentityPermission(PermissionState.None)
- publisherPerm2.FromXml(publisherPerm1.ToXml())
- Console.WriteLine("Result of ToFromXml = " + publisherPerm2.ToString())
-
- End Sub
-End Class
-'
-
-'
-
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ReflectionPermission/VB/reflectionpermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ReflectionPermission/VB/reflectionpermission.vb
deleted file mode 100644
index d7a582a7d36..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ReflectionPermission/VB/reflectionpermission.vb
+++ /dev/null
@@ -1,122 +0,0 @@
-' This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml and FromXml methods
-' of the ReflectionPermission class.
-'
-Imports System.Security
-Imports System.Security.Permissions
-
-
-
-Public Class ReflectionPermissionDemo
-
- ' Demonstrate all methods.
- Public Shared Sub Main(ByVal args() As String)
- IsSubsetOfDemo()
- CopyDemo()
- UnionDemo()
- IntersectDemo()
- ToFromXmlDemo()
- Console.WriteLine("Press the Enter key to exit.")
- Console.ReadLine()
-
- End Sub
-
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- '
- Private Shared Sub IsSubsetOfDemo()
-
- Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
- '
- Dim restrictedMemberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)
- '
- If restrictedMemberAccessPerm.IsSubsetOf(memberAccessPerm) Then
- Console.WriteLine(restrictedMemberAccessPerm.Flags + " is a subset of " + memberAccessPerm.Flags)
- Else
- Console.WriteLine(restrictedMemberAccessPerm.Flags.ToString() + _
- " is not a subset of " + memberAccessPerm.Flags.ToString())
- End If
-
- End Sub
-
- '
- ' Union creates a new permission that is the union of the current permission and the specified permission.
- '
- Private Shared Sub UnionDemo()
- Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
- Dim restrictedMemberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)
- Dim reflectionPerm3 As ReflectionPermission = _
- CType(memberAccessPerm.Union(restrictedMemberAccessPerm), ReflectionPermission)
- If reflectionPerm3 Is Nothing Then
- Console.WriteLine("The union of " + memberAccessPerm.Flags.ToString() + " and " + _
- restrictedMemberAccessPerm.Flags.ToString() + " is null.")
- Else
- Console.WriteLine("The union of " + memberAccessPerm.Flags.ToString() + _
- " and " + restrictedMemberAccessPerm.Flags.ToString() + " = " + _
- CType(reflectionPerm3, ReflectionPermission).Flags.ToString())
- End If
-
- End Sub
-
-
- '
- ' Intersect creates and returns a new permission that is the intersection of the current
- ' permission and the permission specified.
- '
- Private Shared Sub IntersectDemo()
- Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
- Dim restrictedMemberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)
- Dim reflectionPerm3 As ReflectionPermission = CType(memberAccessPerm.Intersect(restrictedMemberAccessPerm), ReflectionPermission)
- If Not (reflectionPerm3 Is Nothing) Then
- Console.WriteLine("The intersection of " + memberAccessPerm.Flags.ToString() + _
- " and " + restrictedMemberAccessPerm.Flags.ToString() + " = " + _
- CType(reflectionPerm3, ReflectionPermission).Flags.ToString())
- Else
- Console.WriteLine("The intersection of " + memberAccessPerm.Flags.ToString + " and " + _
- restrictedMemberAccessPerm.Flags.ToString() + " is null.")
- End If
-
- End Sub
-
-
- '
- 'Copy creates and returns an identical copy of the current permission.
- '
- Private Shared Sub CopyDemo()
- Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
- Dim restrictedMemberAccessPerm As ReflectionPermission = CType(memberAccessPerm.Copy(), ReflectionPermission)
- Console.WriteLine("Result of copy = " + restrictedMemberAccessPerm.ToString())
-
- End Sub
-
- '
- ' ToXml creates an XML encoding of the permission and its current state;
- ' FromXml reconstructs a permission with the specified state from the XML encoding.
- '
- Private Shared Sub ToFromXmlDemo()
- Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
- '
- Dim restrictedMemberAccessPerm As New ReflectionPermission(PermissionState.None)
- '
- restrictedMemberAccessPerm.FromXml(memberAccessPerm.ToXml())
- Console.WriteLine("Result of ToFromXml = " + restrictedMemberAccessPerm.ToString())
-
- End Sub
-End Class
-'
-
-' This code example creates the following output:
-'RestrictedMemberAccess is not a subset of MemberAccess
-'Result of copy =
-'The union of MemberAccess and RestrictedMemberAccess = MemberAccess, RestrictedM
-'emberAccess
-'The intersection of MemberAccess and RestrictedMemberAccess is null.
-'Result of ToFromXml =
-'Press the Enter key to exit.
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.RegistryPermission/VB/registrypermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.RegistryPermission/VB/registrypermission.vb
deleted file mode 100644
index 271f9dd2587..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.RegistryPermission/VB/registrypermission.vb
+++ /dev/null
@@ -1,159 +0,0 @@
-'
-' This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml
-' GetPathList, AddPathList, and SetPathList methods
-' of the RegistryPermission class.
-
-Imports System.Security
-Imports System.Security.Permissions
-Imports System.Collections
-
-Public Class RegistryPermissionDemo
- Private Shared readPerm1 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
- Private Shared readPerm2 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION")
- Private Shared readPerm3 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
- Private Shared createPerm1 As New RegistryPermission(RegistryPermissionAccess.Create, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
- Private Shared readPerm4 As IPermission
-
- Public Shared Sub Main(ByVal args() As String)
-
- IsSubsetOfDemo()
- UnionDemo()
- IntersectDemo()
- CopyDemo()
- ToFromXmlDemo()
- SetGetPathListDemo()
-
- End Sub
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Shared Function IsSubsetOfDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- If readPerm1.IsSubsetOf(readPerm2) Then
-
- Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) + vbLf + " is a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + vbLf)
- Else
- Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) + vbLf + " is not a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + vbLf)
- End If
- If createPerm1.IsSubsetOf(readPerm1) Then
-
- Console.WriteLine("RegistryPermissionAccess.Create" + vbLf + " is a subset of " + "RegistryPermissionAccess.Read" + vbLf)
- Else
- Console.WriteLine("RegistryPermissionAccess.Create" + vbLf + " is not a subset of " + "RegistryPermissionAccess.Read" + vbLf)
- End If
-
- Return returnValue
-
- End Function 'IsSubsetOfDemo
-
- '
- '
- ' Union creates a new permission that is the union of the current permission and
- ' the specified permission.
- Private Shared Function UnionDemo() As Boolean
-
- Dim returnValue As Boolean = True
- readPerm3 = CType(readPerm1.Union(readPerm2), RegistryPermission)
-
- If readPerm3 Is Nothing Then
- Console.WriteLine("The union of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null.")
- Else
- Console.WriteLine("The union of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = " + vbLf + vbTab + CType(readPerm3, RegistryPermission).GetPathList(RegistryPermissionAccess.Read).ToString())
- End If
-
- Return returnValue
-
- End Function 'UnionDemo
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the
- ' current permission and the permission specified.
- Private Shared Function IntersectDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- readPerm3 = CType(readPerm1.Intersect(readPerm2), RegistryPermission)
- If Not (readPerm3 Is Nothing) AndAlso Not (readPerm3.GetPathList(RegistryPermissionAccess.Read) Is Nothing) Then
-
- Console.WriteLine("The intersection of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = " + vbLf + vbTab + CType(readPerm3, RegistryPermission).GetPathList(RegistryPermissionAccess.Read).ToString())
- Else
- Console.WriteLine("The intersection of " + vbLf + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null. ")
- End If
-
- Return returnValue
-
- End Function 'IntersectDemo
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Shared Function CopyDemo() As Boolean
-
- Dim returnValue As Boolean = True
- readPerm4 = CType(readPerm1.Copy(), RegistryPermission)
- If Not (readPerm4 Is Nothing) Then
- Console.WriteLine("Result of copy = " + readPerm4.ToXml().ToString() + vbLf)
- Else
- Console.WriteLine("Result of copy is null. " + vbLf)
- End If
- Return returnValue
-
- End Function 'CopyDemo
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml
- ' reconstructs a permission with the specified state from the XML encoding.
- Private Shared Function ToFromXmlDemo() As Boolean
-
- Dim returnValue As Boolean = True
- '
- readPerm2 = New RegistryPermission(PermissionState.None)
- readPerm2.FromXml(readPerm1.ToXml())
- Console.WriteLine("Result of ToFromXml = " + readPerm2.ToString() + vbLf)
- '
-
- Return returnValue
-
- End Function 'ToFromXmlDemo
-
- '
- '
- ' AddPathList adds access for the specified registry variables to the existing state of the permission.
- ' SetPathList sets new access for the specified registry variable names to the existing state of the permission.
- ' GetPathList gets paths for all registry variables with the specified RegistryPermissionAccess.
- Private Shared Function SetGetPathListDemo() As Boolean
- Try
- Console.WriteLine("********************************************************" + vbLf)
- '
- Dim readPerm1 As RegistryPermission
- Console.WriteLine("Creating RegistryPermission with AllAccess rights for 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
- readPerm1 = New RegistryPermission(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
- '
- Console.WriteLine("Adding 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION' to the write access list, " + "and " + vbLf + " 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0' " + "to the read access list.")
- readPerm1.AddPathList(RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION")
- readPerm1.AddPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
- Console.WriteLine("Read access list before SetPathList = " + readPerm1.GetPathList(RegistryPermissionAccess.Read))
- Console.WriteLine("Setting read access rights to " + vbLf + "'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
- readPerm1.SetPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
- Console.WriteLine("Read access list after SetPathList = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read))
- Console.WriteLine("Write access = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Write))
- Console.WriteLine("Write access Registry variables = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.AllAccess))
- Catch e As ArgumentException
- ' RegistryPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
- Console.WriteLine("An ArgumentException occurred as a result of using AllAccess. " + _
- "AllAccess cannot be used as a parameter in GetPathList because it represents more than one " + _
- "type of registry variable access : " + vbLf + e.Message)
- End Try
-
- Return True
-
- End Function 'SetGetPathListDemo
-
- '
-
-End Class
-
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/VB/securitypermissionattribute.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/VB/securitypermissionattribute.vb
deleted file mode 100644
index a65337bbf06..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/VB/securitypermissionattribute.vb
+++ /dev/null
@@ -1,324 +0,0 @@
-'
-' This sample demonstrates the use of the SecurityPermissionAttribute.
-Imports System.Security.Permissions
-Imports System.Security
-
-Class [MyClass]
-
- Public Shared Sub PermissionDemo()
- Try
- DenySecurityPermissions()
- DenyAllSecurityPermissions()
- DoNotDenySecurityPermissions()
- Catch e As Exception
- Console.WriteLine(e.Message.ToString())
- End Try
- End Sub
-
-
-
-
- ' This method demonstrates the use of the SecurityPermissionAttribute to deny individual security permissions.
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- ' Set the Assertion,UnmanagedCode, ControlAppDomain, ControlDomainPolicy, ontrolEvidence,
- ' ControlPolicy, ControlPrincipal, ControlThread, Execution, Flags, Infrastructure,
- ' RemotingConfiguration, SerializationFormatter, and SkipVerification properties.
- _
- Public Shared Sub DenySecurityPermissions()
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- '
- Console.WriteLine("Executing DenySecurityPermissions.")
- Console.WriteLine("Denied all permissions individually.")
- TestSecurityPermissions()
- End Sub
-
-
- ' This method demonstrates the use of SecurityPermissionFlag.AllFlags to deny all security permissions.
- _
- Public Shared Sub DenyAllSecurityPermissions()
- Console.WriteLine(ControlChars.Lf & "Executing DenyAllSecurityPermissions.")
- Console.WriteLine("Denied all permissions using SecurityPermissionFlag.AllFlags.")
- TestSecurityPermissions()
- End Sub
-
-
- ' This method demonstrates the effect of not denying security permissions.
- Public Shared Sub DoNotDenySecurityPermissions()
- Console.WriteLine(ControlChars.Lf & "Executing DoNotDenySecurityPermissions.")
- Console.WriteLine("No permissions have been denied.")
- DemandSecurityPermissions()
- End Sub
-
-
- Public Shared Sub TestSecurityPermissions()
- Console.WriteLine(ControlChars.Lf & "Executing TestSecurityPermissions." & ControlChars.Lf)
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Assertion)
- Console.WriteLine("Demanding SecurityPermissionFlag.Assertion")
- ' This demand should cause an exception.
- sp.Demand()
- ' The TestFailed method is called if an exception is not thrown.
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Assertion failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlAppDomain)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlAppDomain")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlAppDomain failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlDomainPolicy)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlDomainPolicy")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlDomainPolicy failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlEvidence)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlEvidence")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlEvidence failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlPolicy)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlPolicy")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlPolicy failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlPrincipal)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlPrincipal")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlPrincipal failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlThread)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlThread")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlThread failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Execution)
- Console.WriteLine("Demanding SecurityPermissionFlag.Execution")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Execution failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Infrastructure)
- Console.WriteLine("Demanding SecurityPermissionFlag.Infrastructure")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Infrastructure failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.RemotingConfiguration)
- Console.WriteLine("Demanding SecurityPermissionFlag.RemotingConfiguration")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.RemotingConfiguration failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.SerializationFormatter)
- Console.WriteLine("Demanding SecurityPermissionFlag.SerializationFormatter")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.SerializationFormatter failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.SkipVerification)
- Console.WriteLine("Demanding SecurityPermissionFlag.SkipVerification")
- sp.Demand()
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.SkipVerification failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
- Console.WriteLine("Demanding SecurityPermissionFlag.UnmanagedCode")
- ' This demand should cause an exception.
- sp.Demand()
- ' The TestFailed method is called if an exception is not thrown.
- TestFailed()
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.UnmanagedCode failed: " & e.Message))
- End Try
- End Sub
-
-
- Public Shared Sub TestFailed()
- Console.WriteLine("In TestFailed method.")
- Console.WriteLine("Throwing an exception.")
- Throw New Exception()
- End Sub
-
-'
- Public Shared Sub DemandSecurityPermissions()
- Console.WriteLine(ControlChars.Lf & "Executing DemandSecurityPermissions." & ControlChars.Lf)
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Assertion)
- Console.WriteLine("Demanding SecurityPermissionFlag.Assertion")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.Assertion succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Assertion failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlAppDomain)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlAppDomain")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlAppDomain succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlAppDomain failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlDomainPolicy)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlDomainPolicy")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlDomainPolicy succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlDomainPolicy failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlEvidence)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlEvidence")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlEvidence succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlEvidence failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlPolicy)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlPolicy")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlPolicy succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlPolicy failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlPrincipal)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlPrincipal")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlPrincipal succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlPrincipal failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.ControlThread)
- Console.WriteLine("Demanding SecurityPermissionFlag.ControlThread")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.ControlThread succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.ControlThread failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Execution)
- Console.WriteLine("Demanding SecurityPermissionFlag.Execution")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.Execution succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Execution failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.Infrastructure)
- Console.WriteLine("Demanding SecurityPermissionFlag.Infrastructure")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.Infrastructure succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.Infrastructure failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.RemotingConfiguration)
- Console.WriteLine("Demanding SecurityPermissionFlag.RemotingConfiguration")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.RemotingConfiguration succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.RemotingConfiguration failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.SerializationFormatter)
- Console.WriteLine("Demanding SecurityPermissionFlag.SerializationFormatter")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.SerializationFormatter succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.SerializationFormatter failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.SkipVerification)
- Console.WriteLine("Demanding SecurityPermissionFlag.SkipVerification")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.SkipVerification succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.SkipVerification failed: " & e.Message))
- End Try
- Try
- Dim sp As New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
- Console.WriteLine("Demanding SecurityPermissionFlag.UnmanagedCode")
- sp.Demand()
- Console.WriteLine("Demand for SecurityPermissionFlag.UnmanagedCode succeeded.")
- Catch e As Exception
- Console.WriteLine(("Demand for SecurityPermissionFlag.UnmanagedCode failed: " & e.Message))
- End Try
- End Sub
-'
-
- Overloads Shared Sub Main(ByVal args() As String)
- PermissionDemo()
- End Sub
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/VB/program.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/VB/program.vb
deleted file mode 100644
index 2b60999eab2..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/VB/program.vb
+++ /dev/null
@@ -1,125 +0,0 @@
-'
-Imports System.Security.Permissions
-Imports System.Security.Cryptography
-Imports System.Security.Cryptography.X509Certificates
-Imports System.Security
-Imports System.IO
-
-
-
-Public Class X509store2
-
- Public Shared Sub Main(ByVal args() As String)
- '
- Console.WriteLine("Creating a permission with Flags = OpenStore.")
- Dim sp As New System.Security.Permissions.StorePermission(StorePermissionFlags.OpenStore)
- '
- 'Create a new X509 store named teststore from the local certificate store.
- 'You must put in a valid path to a certificate in the following constructor.
- Dim certificate As New X509Certificate2("c:\certificates\*****.cer")
- ' Deny the permission to open a store.
- sp.Deny()
- ' The following code results in an exception due to an attempt to open a store.
- AddToStore(certificate)
- ' Remove the deny for opening a store.
- CodeAccessPermission.RevertDeny()
- ' The following code results in an exception due to an attempt to add a certificate.
- ' The exception is thrown due to a StorePermissionAttribute on the method denying AddToStore permission.
- AddToStore(certificate)
- ' The current code is not affected by the attribute in the previously called method, so the following
- ' intructions execute without an exception.
- Dim store As New X509Store("teststore", StoreLocation.CurrentUser)
- store.Open(OpenFlags.ReadWrite)
- store.Add(certificate)
-
- ' Demonstrate the behavior of the class members.
- ShowMembers()
-
- Console.WriteLine("Press the Enter key to exit.")
- Console.ReadKey()
- Return
-
- End Sub
-
- '
- 'Deny the permission the ability to add to a store.
- _
- Private Shared Sub AddToStore(ByVal cert As X509Certificate2)
- Try
- Dim store As New X509Store("teststore", StoreLocation.CurrentUser)
- store.Open(OpenFlags.ReadWrite)
- ' The following attempt to add a certificate results in an exception being thrown.
- store.Add(cert)
- Return
- Catch e As SecurityException
- Console.WriteLine("Security exception thrown when attempting: " + _
- CType(e.FirstPermissionThatFailed, System.Security.Permissions.StorePermission).Flags)
- Return
- End Try
-
- End Sub
-
- '
- ' The following method is intended to demonstrate only the behavior of
- ' StorePermission class members,and not their practical usage. Most properties
- ' and methods in this class are used for the resolution and enforcement of
- ' security policy by the security infrastructure code.
- Private Shared Sub ShowMembers()
- Console.WriteLine("Creating first permission with Flags = OpenStore.")
-
- Dim sp1 As New System.Security.Permissions.StorePermission(StorePermissionFlags.OpenStore)
-
- Console.WriteLine("Creating second permission with Flags = AllFlags.")
-
- Dim sp2 As New System.Security.Permissions.StorePermission(StorePermissionFlags.AllFlags)
-
- Console.WriteLine("Creating third permission as Unrestricted.")
- '
- Dim sp3 As New System.Security.Permissions.StorePermission(PermissionState.Unrestricted)
- '
- Console.WriteLine("Creating fourth permission with a permission state of none.")
-
- Dim sp4 As New System.Security.Permissions.StorePermission(PermissionState.None)
- '
- Dim rc As Boolean = sp2.IsSubsetOf(sp3)
- Console.WriteLine("Is the permission with complete store access (AllFlags) a subset of " + _
- vbLf + vbTab + "the permission with an Unrestricted permission state? " + _
- IIf(rc, "Yes", "No"))
- rc = sp1.IsSubsetOf(sp2)
- Console.WriteLine("Is the permission with OpenStore access a subset of the permission with " + _
- vbLf + vbTab + "complete store access (AllFlags)? " + IIf(rc, "Yes", "No"))
- '
- '
- rc = sp3.IsUnrestricted()
- Console.WriteLine("Is the third permission unrestricted? " + IIf(rc, "Yes", "No"))
- '
- '
- Console.WriteLine("Copying the second permission to the fourth permission.")
- sp4 = CType(sp2.Copy(), System.Security.Permissions.StorePermission)
- rc = sp4.Equals(sp2)
- Console.WriteLine("Is the fourth permission equal to the second permission? " + _
- IIf(rc, "Yes", "No"))
- '
- '
- Console.WriteLine("Creating the intersection of the second and first permissions.")
- sp4 = CType(sp2.Intersect(sp1), System.Security.Permissions.StorePermission)
- Console.WriteLine("Value of the Flags property is: " + sp4.Flags.ToString())
-
- '
- '
- Console.WriteLine("Creating the union of the second and first permissions.")
- sp4 = CType(sp2.Union(sp1), System.Security.Permissions.StorePermission)
- Console.WriteLine("Result of the union of the second permission with the first: " + _
- sp4.Flags)
-
- '
- '
- Console.WriteLine("Using an XML roundtrip to reset the fourth permission.")
- sp4.FromXml(sp2.ToXml())
- rc = sp4.Equals(sp2)
- Console.WriteLine("Does the XML roundtrip result equal the original permission? " + _
- IIf(rc, "Yes", "No"))
- '
- End Sub
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/VB/strongnameidentity.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/VB/strongnameidentity.vb
deleted file mode 100644
index bc5a4aa5c5b..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/VB/strongnameidentity.vb
+++ /dev/null
@@ -1,218 +0,0 @@
- '
-Imports System.Security
-Imports System.Security.Permissions
-
-
-
-
-Public Class StrongNameIdentityDemo
- ' Public key
- Private Shared b1 As Byte() = {0, 36, 0, 0, 4, 128, 0, 0, 148, 0, 0, 0, 6, 2, 0, 0, 0, 36, 0, 0, 82, 83, 65, 49, 0, 4, 0, 0, 1, 0, 1, 0, 237, 146, 145, 51, 34, 97, 123, 196, 90, 174, 41, 170, 173, 221, 41, 193, 175, 39, 7, 151, 178, 0, 230, 152, 218, 8, 206, 206, 170, 84, 111, 145, 26, 208, 158, 240, 246, 219, 228, 34, 31, 163, 11, 130, 16, 199, 111, 224, 4, 112, 46, 84, 0, 104, 229, 38, 39, 63, 53, 189, 0, 157, 32, 38, 34, 109, 0, 171, 114, 244, 34, 59, 9, 232, 150, 192, 247, 175, 104, 143, 171, 42, 219, 66, 66, 194, 191, 218, 121, 59, 92, 42, 37, 158, 13, 108, 210, 189, 9, 203, 204, 32, 48, 91, 212, 101, 193, 19, 227, 107, 25, 133, 70, 2, 220, 83, 206, 71, 102, 245, 104, 252, 87, 109, 190, 56, 34, 180}
-
- Private blob As New StrongNamePublicKeyBlob(b1)
- ' Use this version number.
- Private v1 As New Version("1.0.0.0")
-
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Function IsSubsetOfDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim snIdPerm1, snIdPerm2 As StrongNameIdentityPermission
-
- '
- snIdPerm1 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", New Version("1.0.0.0"))
- '
- snIdPerm2 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", New Version("1.0.0.0"))
-
- If snIdPerm1.IsSubsetOf(snIdPerm2) Then
-
- Console.WriteLine("MyCompany.MyDepartment.* is a subset " + "of MyCompany.MyDepartment.MyFile " + vbLf)
- Else
- Console.WriteLine("MyCompany.MyDepartment.*" + " is not a subset of MyCompany.MyDepartment.MyFile " + vbLf)
- End If
-
- Return returnValue
-
- End Function 'IsSubsetOfDemo
-
- '
- '
- ' Union creates a new permission that is the union of the current permission and the specified permission.
- Private Function UnionDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim snIdPerm1, snIdPerm2 As StrongNameIdentityPermission
- Dim snIdPerm3 As IPermission
-
- snIdPerm1 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", New Version("1.0.0.0"))
- snIdPerm2 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", New Version("1.0.0.0"))
-
- snIdPerm3 = CType(snIdPerm1.Union(snIdPerm2), StrongNameIdentityPermission)
-
- Try
- Console.WriteLine("The union of MyCompany.MyDepartment.*" + "and MyCompany.MyDepartment.MyFile is " + CType(snIdPerm3, StrongNameIdentityPermission).Name.ToString())
- Catch e As Exception
- Console.WriteLine("An expected exception was thrown: " + e.Message)
- End Try
-
-
- Return returnValue
-
- End Function 'UnionDemo
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the current
- ' permission and the permission specified.
- Private Function IntersectDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim snIdPerm1, snIdPerm2, snIdPerm3 As StrongNameIdentityPermission
-
- snIdPerm1 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", New Version("1.0.0.0"))
- snIdPerm2 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", New Version("1.0.0.0"))
-
- Try
-
- snIdPerm3 = CType(snIdPerm1.Intersect(snIdPerm2), StrongNameIdentityPermission)
-
- Console.WriteLine("The intersection of MyCompany.MyDepartment.*" + "MyCompany.MyDepartment.MyFile is " + CType(snIdPerm3, StrongNameIdentityPermission).Name.ToString())
-
- Catch e As Exception
- Console.WriteLine("An exception was thrown: " + e.ToString())
- returnValue = False
- End Try
-
- Return returnValue
-
- End Function 'IntersectDemo
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Function CopyDemo() As Boolean
- Dim returnValue As Boolean = True
-
- Dim snIdPerm1, snIdPerm2 As StrongNameIdentityPermission
-
- snIdPerm1 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", New Version("1.0.0.0"))
- '
- snIdPerm2 = New StrongNameIdentityPermission(PermissionState.None)
- '
- snIdPerm2 = CType(snIdPerm1.Copy(), StrongNameIdentityPermission)
- Console.WriteLine("Result of copy = " + snIdPerm2.ToString() + vbLf)
-
- Return returnValue
-
- End Function 'CopyDemo
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state;
- 'FromXml reconstructs a permission with the specified state from the XML encoding.
- Private Function ToFromXmlDemo() As Boolean
-
- Dim returnValue As Boolean = True
-
- Dim snIdPerm1, snIdPerm2 As StrongNameIdentityPermission
-
- snIdPerm1 = New StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", New Version("1.0.0.0"))
- snIdPerm2 = New StrongNameIdentityPermission(PermissionState.None)
- snIdPerm2.FromXml(snIdPerm1.ToXml())
- Console.WriteLine("Result of ToFromXml = " + snIdPerm2.ToString() + vbLf)
-
- Return returnValue
-
- End Function 'ToFromXmlDemo
-
- '
- ' Invoke all demos.
- Public Function runDemo() As Boolean
-
- Dim ret As Boolean = True
- Dim retTmp As Boolean
- ' Call the IsSubsetOf demo.
- retTmp = IsSubsetOfDemo()
- If retTmp Then
- Console.Out.WriteLine("IsSubsetOf demo completed successfully.")
- Else
- Console.Out.WriteLine("IsSubsetOf demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the Union demo.
- retTmp = UnionDemo()
- If retTmp Then
- Console.Out.WriteLine("Union demo completed successfully.")
- Else
- Console.Out.WriteLine("Union demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the Intersect demo.
- retTmp = IntersectDemo()
- If retTmp Then
- Console.Out.WriteLine("Intersect demo completed successfully.")
- Else
- Console.Out.WriteLine("Intersect demo failed.")
- End If
- ret = retTmp AndAlso ret
-
-
- ' Call the Copy demo.
- retTmp = CopyDemo()
- If retTmp Then
- Console.Out.WriteLine("Copy demo completed successfully")
- Else
- Console.Out.WriteLine("Copy demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- ' Call the ToFromXml demo.
- retTmp = ToFromXmlDemo()
- If retTmp Then
- Console.Out.WriteLine("ToFromXml demo completed successfully")
- Else
- Console.Out.WriteLine("ToFromXml demo failed.")
- End If
- ret = retTmp AndAlso ret
-
- Console.WriteLine("********************************************************" + ControlChars.Lf)
-
-
- Return ret
- End Function 'runDemo
-
-
- ' Test harness.
- Public Overloads Shared Sub Main(ByVal args() As [String])
- Try
- Dim democase As New StrongNameIdentityDemo()
- Dim ret As Boolean = democase.runDemo()
- If ret Then
- Console.Out.WriteLine("StrongNameIdentity demo completed successfully.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 100
- Else
- Console.Out.WriteLine("StrongNameIdentity demo failed.")
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End If
- Catch e As Exception
- Console.Out.WriteLine("StrongNameIdentity demo failed.")
- Console.WriteLine(e.ToString())
- Console.Out.WriteLine("Press the Enter key to exit.")
- Dim consoleInput As String = Console.ReadLine()
- System.Environment.ExitCode = 101
- End Try
- End Sub
-End Class
-
-'
-
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/VB/uipermission.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/VB/uipermission.vb
deleted file mode 100644
index 2c1f8592e95..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/VB/uipermission.vb
+++ /dev/null
@@ -1,165 +0,0 @@
-'
-Imports System.Security
-Imports System.Security.Permissions
-
-
-
-Public Class UIPermissionDemo
-
-
- Public Shared Sub Main(ByVal args() As String)
- IsSubsetOfDemo()
- CopyDemo()
- UnionDemo()
- IntersectDemo()
- ToFromXmlDemo()
-
- End Sub
-
-
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Shared Sub IsSubsetOfDemo()
- '
- Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows)
- '
- Dim uiPerm2 As New UIPermission(UIPermissionWindow.SafeSubWindows)
- CheckIsSubsetOfWindow(uiPerm1, uiPerm2)
- '
- uiPerm1 = New UIPermission(UIPermissionClipboard.AllClipboard)
- '
- uiPerm2 = New UIPermission(UIPermissionClipboard.OwnClipboard)
- CheckIsSubsetOfClipBoard(uiPerm1, uiPerm2)
-
- End Sub
-
- Private Shared Sub CheckIsSubsetOfWindow(ByVal uiPerm1 As UIPermission, ByVal uiPerm2 As UIPermission)
- If uiPerm1.IsSubsetOf(uiPerm2) Then
- Console.WriteLine(uiPerm1.Window.ToString() + " is a subset of " + uiPerm2.Window.ToString())
- Else
- Console.WriteLine(uiPerm1.Window.ToString() + " is not a subset of " + uiPerm2.Window.ToString())
- End If
-
- If uiPerm2.IsSubsetOf(uiPerm1) Then
- Console.WriteLine(uiPerm2.Window.ToString() + " is a subset of " + uiPerm1.Window.ToString())
- Else
- Console.WriteLine(uiPerm2.Window.ToString() + " is not a subset of " + uiPerm1.Window.ToString())
- End If
-
- End Sub
-
- Private Shared Sub CheckIsSubsetOfClipBoard(ByVal uiPerm1 As UIPermission, ByVal uiPerm2 As UIPermission)
- If uiPerm1.IsSubsetOf(uiPerm2) Then
- Console.WriteLine(uiPerm1.Clipboard.ToString() + " is a subset of " + uiPerm2.Clipboard.ToString())
- Else
- Console.WriteLine(uiPerm1.Clipboard.ToString() + " is not a subset of " + uiPerm2.Clipboard.ToString())
- End If
-
- If uiPerm2.IsSubsetOf(uiPerm1) Then
- Console.WriteLine(uiPerm2.Clipboard.ToString() + " is a subset of " + uiPerm1.Clipboard.ToString())
- Else
- Console.WriteLine(uiPerm2.Clipboard.ToString() + " is not a subset of " + uiPerm1.Clipboard.ToString())
- End If
-
- End Sub
-
- '
- '
- ' Union creates a new permission that is the union of the current permission
- ' and the specified permission.
- Private Shared Sub UnionDemo()
- Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows)
- Dim uiPerm2 As New UIPermission(UIPermissionWindow.SafeSubWindows)
- Dim p3 As UIPermission = CType(uiPerm1.Union(uiPerm2), UIPermission)
- If Not (p3 Is Nothing) Then
- Console.WriteLine("The union of " + uiPerm1.Window.ToString() + " and " + vbLf + vbTab + uiPerm2.Window.ToString() + " is " + vbLf + vbTab + p3.Window.ToString() + vbLf)
-
- Else
- Console.WriteLine("The union of " + uiPerm1.Window.ToString() + " and " + vbLf + vbTab + uiPerm2.Window.ToString() + " is null." + vbLf)
- End If
-
- End Sub
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the
- ' current permission and the permission specified.
- Private Shared Sub IntersectDemo()
- '
- Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard)
- '
- Dim uiPerm2 As New UIPermission(UIPermissionWindow.SafeSubWindows, UIPermissionClipboard.NoClipboard)
- Dim p3 As UIPermission = CType(uiPerm1.Intersect(uiPerm2), UIPermission)
-
- Console.WriteLine("The intersection of " + uiPerm1.Window.ToString() + " and " + vbLf + vbTab + uiPerm2.Window.ToString() + " is " + p3.Window.ToString() + vbLf)
- Console.WriteLine("The intersection of " + uiPerm1.Clipboard.ToString() + " and " + vbLf + vbTab + uiPerm2.Clipboard.ToString() + " is " + p3.Clipboard.ToString() + vbLf)
-
- End Sub
-
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Shared Sub CopyDemo()
-
- Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows)
- '
- Dim uiPerm2 As New UIPermission(PermissionState.None)
- '
- uiPerm2 = CType(uiPerm1.Copy(), UIPermission)
- If Not (uiPerm2 Is Nothing) Then
- Console.WriteLine("The copy succeeded: " + uiPerm2.ToString() + " " + vbLf)
- End If
-
- End Sub
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
- ' permission with the specified state from the XML encoding.
- Private Shared Sub ToFromXmlDemo()
-
-
- Dim uiPerm1 As New UIPermission(UIPermissionWindow.SafeTopLevelWindows)
- Dim uiPerm2 As New UIPermission(PermissionState.None)
- uiPerm2.FromXml(uiPerm1.ToXml())
- Dim result As Boolean = uiPerm2.Equals(uiPerm1)
- If result Then
- Console.WriteLine("Result of ToFromXml = " + uiPerm2.ToString())
- Else
- Console.WriteLine(uiPerm2.ToString())
- Console.WriteLine(uiPerm1.ToString())
- End If
-
- End Sub
-End Class
-'
-
-'
-' This code example creates the following output:
-
-'SafeTopLevelWindows is not a subset of SafeSubWindows
-'SafeSubWindows is a subset of SafeTopLevelWindows
-'AllClipboard is not a subset of OwnClipboard
-'OwnClipboard is a subset of AllClipboard
-'The copy succeeded:
-
-
-'The union of SafeTopLevelWindows and
-' SafeSubWindows is
-' SafeTopLevelWindows
-
-'The intersection of SafeTopLevelWindows and
-' SafeSubWindows is SafeSubWindows
-
-'The intersection of OwnClipboard and
-' NoClipboard is NoClipboard
-
-'Result of ToFromXml =
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/VB/urlidentity.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/VB/urlidentity.vb
deleted file mode 100644
index 8f0ab8d9738..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/VB/urlidentity.vb
+++ /dev/null
@@ -1,123 +0,0 @@
-'
-Imports System.Security
-Imports System.Security.Permissions
-
-
-
-Public Class UrlIdentityPermissionDemo
-
- Public Shared Sub Main(ByVal args() As String)
- IsSubsetOfDemo()
- CopyDemo()
- IntersectDemo()
- ToFromXmlDemo()
-
- End Sub
-
-
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Shared Sub IsSubsetOfDemo()
- '
- Dim permIdPerm1 As New UrlIdentityPermission("http://www.fourthcoffee.com/process/")
- '
- Dim permIdPerm2 As New UrlIdentityPermission("http://www.fourthcoffee.com/*")
-
- If permIdPerm1.IsSubsetOf(permIdPerm2) Then
- Console.WriteLine(permIdPerm1.Url + " is a subset of " + permIdPerm2.Url)
- Else
- Console.WriteLine(permIdPerm1.Url + " is not a subset of " + permIdPerm2.Url)
- End If
- If permIdPerm2.IsSubsetOf(permIdPerm1) Then
- Console.WriteLine(permIdPerm2.Url + " is a subset of " + permIdPerm1.Url)
- Else
- Console.WriteLine(permIdPerm2.Url + " is not a subset of " + permIdPerm1.Url)
- End If
-
- End Sub
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the
- ' current permission and the permission specified.
- Private Shared Sub IntersectDemo()
-
- Dim permIdPerm1 As New UrlIdentityPermission("http://www.fourthcoffee.com/process/")
- Dim permIdPerm2 As New UrlIdentityPermission("http://www.fourthcoffee.com/*")
- Dim p3 As UrlIdentityPermission = CType(permIdPerm1.Intersect(permIdPerm2), UrlIdentityPermission)
-
- If Not (p3 Is Nothing) Then
- Console.WriteLine("The intersection of " + permIdPerm1.Url + " and " + vbLf + vbTab + permIdPerm2.Url + " is " + p3.Url + vbLf)
-
- Else
- Console.WriteLine("The intersection of " + permIdPerm1.Url + " and " + vbLf + vbTab + permIdPerm2.Url + " is null." + vbLf)
- End If
-
- End Sub
-
-
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Shared Sub CopyDemo()
-
- Dim permIdPerm1 As New UrlIdentityPermission("http://www.fourthcoffee.com/process/*")
- '
- Dim permIdPerm2 As New UrlIdentityPermission(PermissionState.None)
- '
- permIdPerm2 = CType(permIdPerm1.Copy(), UrlIdentityPermission)
- If Not (permIdPerm2 Is Nothing) Then
- Console.WriteLine("The copy succeeded: " + permIdPerm2.ToString() + " " + vbLf)
- End If
-
- End Sub
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
- ' permission with the specified state from the XML encoding.
- Private Shared Sub ToFromXmlDemo()
-
-
- Dim permIdPerm1 As New UrlIdentityPermission("http://www.fourthcoffee.com/process/*")
- Dim permIdPerm2 As New UrlIdentityPermission(PermissionState.None)
- permIdPerm2.FromXml(permIdPerm1.ToXml())
- Dim result As Boolean = permIdPerm2.Equals(permIdPerm1)
- If result Then
- Console.WriteLine("Result of ToFromXml = " + permIdPerm2.ToString())
- Else
- Console.WriteLine(permIdPerm2.ToString())
- Console.WriteLine(permIdPerm1.ToString())
- End If
-
- End Sub
-End Class
-'
-
-'
-' This code example creates the following output:
-
-'http://www.fourthcoffee.com/process/ is a subset of http://www.fourthcoffee.com/
-'*
-'http://www.fourthcoffee.com/* is not a subset of http://www.fourthcoffee.com/pro
-'cess/
-'The copy succeeded:
-
-
-'The union of http://www.fourthcoffee.com/process/ and
-' http://www.fourthcoffee.com/* failed.
-'The operation is ambiguous because the permission represents multiple identities
-'.
-'The intersection of http://www.fourthcoffee.com/process/ and
-' http://www.fourthcoffee.com/* is http://www.fourthcoffee.com/process/
-
-'Result of ToFromXml =
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ZoneIdentityPermission/VB/zoneidentity.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ZoneIdentityPermission/VB/zoneidentity.vb
deleted file mode 100644
index 9ea36cf8bd1..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Permissions.ZoneIdentityPermission/VB/zoneidentity.vb
+++ /dev/null
@@ -1,140 +0,0 @@
-'
-Imports System.Security
-Imports System.Security.Permissions
-
-
-
-Public Class ZoneIdentityPermissionDemo
-
- Public Shared Sub Main(ByVal args() As String)
- IsSubsetOfDemo()
- CopyDemo()
- UnionDemo()
- IntersectDemo()
- ToFromXmlDemo()
-
- End Sub
-
-
- '
- ' IsSubsetOf determines whether the current permission is a subset of the specified permission.
- Private Shared Sub IsSubsetOfDemo()
- '
- Dim zoneIdPerm1 As New ZoneIdentityPermission(SecurityZone.Intranet)
- '
- Dim zoneIdPerm2 As New ZoneIdentityPermission(SecurityZone.MyComputer)
-
- If zoneIdPerm1.IsSubsetOf(zoneIdPerm2) Then
- Console.WriteLine(zoneIdPerm1.SecurityZone.ToString() + " is a subset of " + zoneIdPerm2.SecurityZone.ToString())
- Else
- Console.WriteLine(zoneIdPerm1.SecurityZone.ToString() + " is not a subset of " + zoneIdPerm2.SecurityZone.ToString())
- End If
-
- If zoneIdPerm2.IsSubsetOf(zoneIdPerm1) Then
- Console.WriteLine(zoneIdPerm2.SecurityZone.ToString() + " is a subset of " + zoneIdPerm1.SecurityZone.ToString())
- Else
- Console.WriteLine(zoneIdPerm2.SecurityZone.ToString() + " is not a subset of " + zoneIdPerm1.SecurityZone.ToString())
- End If
-
- End Sub
-
- '
- '
- ' Union creates a new permission that is the union of the current permission
- ' and the specified permission.
- Private Shared Sub UnionDemo()
- Dim zoneIdPerm1 As New ZoneIdentityPermission(SecurityZone.Intranet)
- Dim zoneIdPerm2 As New ZoneIdentityPermission(SecurityZone.MyComputer)
- Dim p3 As ZoneIdentityPermission = CType(zoneIdPerm1.Union(zoneIdPerm2), ZoneIdentityPermission)
- If Not (p3 Is Nothing) Then
- Console.WriteLine("The union of " + zoneIdPerm1.SecurityZone.ToString() + " and " + vbLf + vbTab + zoneIdPerm2.SecurityZone.ToString() + " is " + vbLf + vbTab + p3.SecurityZone.ToString() + vbLf)
-
- Else
- Console.WriteLine("The union of " + zoneIdPerm1.SecurityZone.ToString() + " and " + vbLf + vbTab + zoneIdPerm2.SecurityZone.ToString() + " is null." + vbLf)
- End If
-
- End Sub
-
- '
- '
- ' Intersect creates and returns a new permission that is the intersection of the
- ' current permission and the permission specified.
- Private Shared Sub IntersectDemo()
-
- Dim zoneIdPerm1 As New ZoneIdentityPermission(SecurityZone.Intranet)
- Dim zoneIdPerm2 As New ZoneIdentityPermission(SecurityZone.MyComputer)
- Dim p3 As ZoneIdentityPermission = CType(zoneIdPerm1.Intersect(zoneIdPerm2), ZoneIdentityPermission)
-
- If Not (p3 Is Nothing) Then
- Console.WriteLine("The intersection of " + zoneIdPerm1.SecurityZone.ToString() + " and " + vbLf + vbTab + zoneIdPerm2.SecurityZone.ToString() + " is " + p3.SecurityZone.ToString() + vbLf)
-
- Else
- Console.WriteLine("The intersection of " + zoneIdPerm1.SecurityZone.ToString() + " and " + vbLf + vbTab + zoneIdPerm2.SecurityZone.ToString() + " is null." + vbLf)
- End If
-
- End Sub
-
-
-
- '
- '
- 'Copy creates and returns an identical copy of the current permission.
- Private Shared Sub CopyDemo()
-
- Dim zoneIdPerm1 As New ZoneIdentityPermission(SecurityZone.Intranet)
- '
- Dim zoneIdPerm2 As New ZoneIdentityPermission(PermissionState.None)
- '
- zoneIdPerm2 = CType(zoneIdPerm1.Copy(), ZoneIdentityPermission)
- If Not (zoneIdPerm2 Is Nothing) Then
- Console.WriteLine("The copy succeeded: " + zoneIdPerm2.ToString() + " " + vbLf)
- End If
-
- End Sub
-
- '
- '
- ' ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
- ' permission with the specified state from the XML encoding.
- Private Shared Sub ToFromXmlDemo()
-
-
- Dim zoneIdPerm1 As New ZoneIdentityPermission(SecurityZone.Intranet)
- Dim zoneIdPerm2 As New ZoneIdentityPermission(PermissionState.None)
- zoneIdPerm2.FromXml(zoneIdPerm1.ToXml())
- Dim result As Boolean = zoneIdPerm2.Equals(zoneIdPerm1)
- If result Then
- Console.WriteLine("Result of ToFromXml = " + zoneIdPerm2.ToString())
- Else
- Console.WriteLine(zoneIdPerm2.ToString())
- Console.WriteLine(zoneIdPerm1.ToString())
- End If
-
- End Sub
-End Class
-'
-
-'
-' This code example creates the following output:
-
-'Intranet is not a subset of MyComputer
-'MyComputer is not a subset of Intranet
-'The copy succeeded:
-
-
-'The union of Intranet and
-' MyComputer is
-' NoZone
-
-'The intersection of Intranet and
-' MyComputer is null.
-
-'Result of ToFromXml =
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/VB/Form1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/VB/Form1.vb
deleted file mode 100644
index 13679441c98..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/VB/Form1.vb
+++ /dev/null
@@ -1,456 +0,0 @@
-' This sample demonstrates how to use each member of the FileCodeGroup class.
-'
-Imports System.Security
-Imports System.Security.Policy
-Imports System.Security.Permissions
-Imports System.Reflection
-Imports System.Windows.Forms
-
-Public Class Form1
- Inherits System.Windows.Forms.Form
-
- ' Event handler for Run button.
- Private Sub Button1_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button1.Click
-
- tbxOutput.Cursor = Cursors.WaitCursor
- tbxOutput.Text = ""
-
- Dim fileCodeGroup As FileCodeGroup = constructDefaultGroup()
-
- ' Create a deep copy of the FileCodeGroup;
- '
- Dim copyCodeGroup As FileCodeGroup = _
- CType(fileCodeGroup.Copy(), FileCodeGroup)
- '
-
- CompareTwoCodeGroups(fileCodeGroup, copyCodeGroup)
-
- addPolicy(fileCodeGroup)
- addXmlMember(fileCodeGroup)
- updateMembershipCondition(fileCodeGroup)
- addChildCodeGroup(fileCodeGroup)
-
- WriteLine("Comparing the resolved code group with the initial " + _
- "code group:")
- Dim resolvedCodeGroup As FileCodeGroup
- resolvedCodeGroup = ResolveGroupToEvidence(fileCodeGroup)
-
- If (CompareTwoCodeGroups(fileCodeGroup, resolvedCodeGroup)) Then
- PrintCodeGroup(resolvedCodeGroup)
- Else
- PrintCodeGroup(fileCodeGroup)
- End If
-
- ' Reset the cursor and conclude application.
- tbxOutput.AppendText(vbCrLf + "This sample completed " + _
- "successfully; press Exit to continue.")
- tbxOutput.Cursor = Cursors.Default
- End Sub
- ' Construct a new FileCodeGroup with read, write, append and
- ' discovery access.
- Private Function constructDefaultGroup() As FileCodeGroup
- ' Construct a file code group with read, write, append and
- ' discovery access.
- '
- Dim fileCodeGroup As New FileCodeGroup( _
- New AllMembershipCondition, _
- FileIOPermissionAccess.AllAccess)
- '
-
- ' Set the name of the file code group.
- '
- fileCodeGroup.Name = "TempCodeGroup"
- '
-
- ' Set the description of the file code group.
- '
- fileCodeGroup.Description = "Temp folder permissions group"
- '
-
- ' Retrieve the string representation of the Policy's attributes.
- ' FileCodeGroup does not use AttributeString, so the value should
- ' be null.
- '
- If (Not fileCodeGroup.AttributeString Is Nothing) Then
- Throw New NullReferenceException( _
- "AttributeString property is not empty")
- End If
- '
-
- Return fileCodeGroup
- End Function
-
- ' Add file permission to restrict write access to all files on the
- ' local machine.
- Private Sub addPolicy(ByRef fileCodeGroup As FileCodeGroup)
- ' Set the PolicyStatement property to a policy with
- ' read access to c:\.
- '
- Dim rootFilePermissions As New FileIOPermission(PermissionState.None)
- rootFilePermissions.AllLocalFiles = FileIOPermissionAccess.Read
- rootFilePermissions.SetPathList(FileIOPermissionAccess.Read, "C:\\")
-
- Dim namedPermissions As New NamedPermissionSet("RootPermissions")
- namedPermissions.AddPermission(rootFilePermissions)
-
- fileCodeGroup.PolicyStatement = New PolicyStatement(namedPermissions)
- '
- End Sub
-
- ' Set the membership condition of the specified FileCodeGroup to
- ' Intranet zone.
- Private Sub updateMembershipCondition( _
- ByRef fileCodeGroup As FileCodeGroup)
-
- ' Set the membership condition to the Intranet zone.
- '
- Dim zoneCondition As _
- New ZoneMembershipCondition(SecurityZone.Intranet)
-
- fileCodeGroup.MembershipCondition = zoneCondition
- '
- End Sub
-
- ' Add a child group with read-access file permissions to the specified
- ' code group.
- Private Sub addChildCodeGroup(ByRef fileCodeGroup As FileCodeGroup)
- ' Create a file code group with read access.
- '
- Dim tempFolderCodeGroup As New FileCodeGroup( _
- New AllMembershipCondition, _
- FileIOPermissionAccess.Read)
-
- ' Set the name of the child code group and add it to the specified
- ' code group.
- tempFolderCodeGroup.Name = "Read-only group"
- fileCodeGroup.AddChild(tempFolderCodeGroup)
- '
- End Sub
-
- ' Compare two specified FileCodeGroups for equality.
- Private Function CompareTwoCodeGroups( _
- ByVal firstCodeGroup As FileCodeGroup, _
- ByVal secondCodeGroup As FileCodeGroup) As Boolean
-
- ' Compare two FileCodeGroups for equality.
- '
- If (firstCodeGroup.Equals(secondCodeGroup)) Then
- '
- WriteLine("The two code groups are equal.")
- Return True
- Else
- WriteLine("The two code groups are not equal.")
- Return False
- End If
-
- End Function
-
- ' Retrieve the resolved policy based on the executing evidence found
- ' in the specified code group.
- Private Function ResolveEvidence( _
- ByVal fileCodeGroup As CodeGroup) As String
-
- Dim policyString As String = ""
-
- ' Resolve the policy based on the executing assemlby's evidence.
- '
- Dim executingAssembly As [Assembly]
- executingAssembly = Me.GetType().Assembly
-
- Dim executingEvidence As Evidence = executingAssembly.Evidence
-
- Dim policy As PolicyStatement
- policy = fileCodeGroup.Resolve(executingEvidence)
- '
-
- If (Not policy Is Nothing) Then
- policyString = policy.ToString()
- End If
-
- Return policyString
- End Function
-
- ' Retrieve the resolved code group based on the executing evidence found
- ' in the specified code group.
- Private Function ResolveGroupToEvidence( _
- ByVal fileCodeGroup As FileCodeGroup) As FileCodeGroup
-
- ' Resolve matching code groups to the executing assembly.
- '
- Dim executingAssembly As [Assembly]
- executingAssembly = Me.GetType().Assembly
-
- Dim evidence As Evidence = executingAssembly.Evidence
-
- Dim codeGroup As CodeGroup
- codeGroup = fileCodeGroup.ResolveMatchingCodeGroups(evidence)
- '
-
- Return CType(codeGroup, FileCodeGroup)
- End Function
-
- ' If domain attribute is not found in specified FileCodeGroup,
- ' add a child Xml element identifying a custom membership condition.
- Private Sub addXmlMember(ByRef fileCodeGroup As FileCodeGroup)
- '
- Dim xmlElement As SecurityElement = fileCodeGroup.ToXml()
- '
-
- Dim rootElement As New SecurityElement("CodeGroup")
- If (xmlElement.Attribute("domain") Is Nothing) Then
- '
- Dim newElement As New SecurityElement("CustomMembershipCondition")
- newElement.AddAttribute("class", "CustomMembershipCondition")
- newElement.AddAttribute("version", "1")
- newElement.AddAttribute("domain", "contoso.com")
-
- rootElement.AddChild(newElement)
-
- fileCodeGroup.FromXml(rootElement)
- '
-
- End If
-
- WriteLine("Added a custom membership condition:")
- WriteLine(rootElement.ToString())
- End Sub
-
- ' Print the properties of the specified code group to the output textbox.
- Private Sub PrintCodeGroup(ByVal codeGroup As CodeGroup)
- ' Compare specified object's type with the FileCodeGroup type.
- '
- If (Not codeGroup.GetType() Is GetType(FileCodeGroup)) Then
- '
- Throw New ArgumentException("Excepted FileCodeGroup type")
- End If
-
- Dim codeGroupName As String = codeGroup.Name
- Dim membershipCondition As String
- membershipCondition = codeGroup.MembershipCondition.ToString()
-
- '
- Dim permissionSetName As String = codeGroup.PermissionSetName
- '
-
- '
- Dim hashCode As Integer = codeGroup.GetHashCode()
- '
-
- Dim mergeLogic As String = ""
- '
- If (codeGroup.MergeLogic.Equals("Union")) Then
- '
- mergeLogic = " with Union merge logic"
- End If
-
- ' Retrieve the class path for FileCodeGroup.
- '
- Dim fileGroupClass As String = codeGroup.ToString()
- '
-
- ' Write summary to console window.
- WriteLine(vbCrLf + "*** " + fileGroupClass + " summary ***")
- Write("A FileCodeGroup named " + codeGroupName + mergeLogic)
- Write(" has been created with hash code(" + hashCode.ToString())
- Write("). It contains a " + membershipCondition)
- Write(" membership condition with the ")
- Write(permissionSetName + " permission set. ")
-
- WriteLine("It has the following policy: " + _
- ResolveEvidence(codeGroup))
- Dim childCount As Integer = codeGroup.Children.Count
- If (childCount > 0) Then
- Write("There are " + childCount.ToString())
- WriteLine(" child elements in the code group:")
-
- ' Iterate through the child code groups to display their names and
- ' remove them from the specified code group.
- For i As Int16 = 0 To childCount - 1 Step 1
- ' Get child code group as type FileCodeGroup.
- '
- Dim childCodeGroup As FileCodeGroup
- childCodeGroup = CType(codeGroup.Children(i), FileCodeGroup)
- '
-
- Write("Removing the " + childCodeGroup.Name + ".")
- ' Remove child codegroup.
- '
- codeGroup.RemoveChild(childCodeGroup)
- '
- Next
-
- WriteLine("")
-
- Else
- WriteLine("There are no children found in the code group:")
-
- End If
- End Sub
- ' Write message to the output textbox.
- Private Sub Write(ByVal message As String)
- tbxOutput.AppendText(message)
-
- End Sub
- ' Write message with carriage return to the output textbox.
- Private Sub WriteLine(ByVal message As String)
- tbxOutput.AppendText(message + vbCrLf)
-
- End Sub
-
-
- ' Event handler for Exit button.
- Private Sub Button2_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button2.Click
-
- Application.Exit()
- End Sub
-#Region " Windows Form Designer generated code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
-
- 'Add any initialization after the InitializeComponent() call
-
- End Sub
-
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
-
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
-
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents Panel2 As System.Windows.Forms.Panel
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents tbxOutput As System.Windows.Forms.RichTextBox
- _
- Private Sub InitializeComponent()
- Me.Panel2 = New System.Windows.Forms.Panel
- Me.Button1 = New System.Windows.Forms.Button
- Me.Button2 = New System.Windows.Forms.Button
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.tbxOutput = New System.Windows.Forms.RichTextBox
- Me.Panel2.SuspendLayout()
- Me.Panel1.SuspendLayout()
- Me.SuspendLayout()
- '
- 'Panel2
- '
- Me.Panel2.Controls.Add(Me.Button1)
- Me.Panel2.Controls.Add(Me.Button2)
- Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.Panel2.DockPadding.All = 20
- Me.Panel2.Location = New System.Drawing.Point(0, 320)
- Me.Panel2.Name = "Panel2"
- Me.Panel2.Size = New System.Drawing.Size(616, 64)
- Me.Panel2.TabIndex = 1
- '
- 'Button1
- '
- Me.Button1.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button1.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button1.Location = New System.Drawing.Point(446, 20)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(75, 24)
- Me.Button1.TabIndex = 2
- Me.Button1.Text = "&Run"
- '
- 'Button2
- '
- Me.Button2.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button2.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button2.Location = New System.Drawing.Point(521, 20)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(75, 24)
- Me.Button2.TabIndex = 3
- Me.Button2.Text = "E&xit"
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.tbxOutput)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel1.DockPadding.All = 20
- Me.Panel1.Location = New System.Drawing.Point(0, 0)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(616, 320)
- Me.Panel1.TabIndex = 2
- '
- 'tbxOutput
- '
- Me.tbxOutput.AccessibleDescription = _
- "Displays output from application."
- Me.tbxOutput.AccessibleName = "Output textbox."
- Me.tbxOutput.Dock = System.Windows.Forms.DockStyle.Fill
- Me.tbxOutput.Location = New System.Drawing.Point(20, 20)
- Me.tbxOutput.Name = "tbxOutput"
- Me.tbxOutput.Size = New System.Drawing.Size(576, 280)
- Me.tbxOutput.TabIndex = 1
- Me.tbxOutput.Text = "Click the Run button to run the application."
- '
- 'Form1
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
- Me.ClientSize = New System.Drawing.Size(616, 384)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.Panel2)
- Me.Name = "Form1"
- Me.Text = "FileCodeGroup"
- Me.Panel2.ResumeLayout(False)
- Me.Panel1.ResumeLayout(False)
- Me.ResumeLayout(False)
-
- End Sub
-
-#End Region
-End Class
-'
-' This sample produces the following output:
-'
-' The two code groups are equal.
-' Added a custom membership condition:
-'
-'
-'
-'
-' Comparing the resolved code group with the initial code group:
-' The two code groups are not equal.
-'
-' *** System.Security.Policy.FileCodeGroup summary ***
-' A FileCodeGroup named with Union merge logic has been created with hash
-' code (113152269). It contains a Zone - Intranet membership condition with
-' the Same directory FileIO - NoAccess permission set. Has the following
-' policy:
-' There are 1 child elements in the code group:
-' Removing the Read-only group.
-'
-' This sample completed successfully; press Exit to continue.
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/VB/Form1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/VB/Form1.vb
deleted file mode 100644
index 6f40ed3bab3..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/VB/Form1.vb
+++ /dev/null
@@ -1,487 +0,0 @@
-' This sample demonstrates how to use each member of the FirstMatchCodeGroup
-' class.
-'
-Imports System.Security
-Imports System.Security.Policy
-Imports System.Security.Permissions
-Imports System.Reflection
-Imports System.Windows.Forms
-
-Public Class Form1
- Inherits System.Windows.Forms.Form
-
- ' Event handler for Run button.
- Private Sub Button1_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button1.Click
-
- tbxOutput.Cursor = Cursors.WaitCursor
- tbxOutput.Text = ""
-
- ' Create a new FirstMatchCodeGroup.
- Dim codeGroup As FirstMatchCodeGroup = constructDefaultGroup()
-
- ' Create a deep copy of the FirstMatchCodeGroup.
- '
- Dim copyCodeGroup As FirstMatchCodeGroup
- copyCodeGroup = CType(codeGroup.Copy(), FirstMatchCodeGroup)
- '
-
- ' Compare the original code group with the copy.
- CompareTwoCodeGroups(codeGroup, copyCodeGroup)
-
- addPolicy(codeGroup)
- addXmlMember(codeGroup)
- updateMembershipCondition(codeGroup)
- addChildCodeGroup(codeGroup)
-
- Write("Comparing the resolved code group ")
- WriteLine("with the initial code group.")
-
- Dim resolvedCodeGroup As FirstMatchCodeGroup
- resolvedCodeGroup = ResolveGroupToEvidence(codeGroup)
- If (CompareTwoCodeGroups(codeGroup, resolvedCodeGroup)) Then
- PrintCodeGroup(resolvedCodeGroup)
- Else
- PrintCodeGroup(codeGroup)
- End If
-
- ' Reset the cursor and conclude application.
- tbxOutput.AppendText(vbCrLf + "This sample completed " + _
- "successfully; press Exit to continue.")
- tbxOutput.Cursor = Cursors.Default
- End Sub
- ' Create a FirstMatchCodeGroup with an exclusive policy and membership
- ' condition.
- Private Function constructDefaultGroup() As FirstMatchCodeGroup
- ' Construct a new FirstMatchCodeGroup with Read, Write, Append
- ' and PathDiscovery access.
- ' Create read access permission to the root directory on drive C.
- '
- Dim rootFilePermissions As New FileIOPermission(PermissionState.None)
- rootFilePermissions.AllLocalFiles = FileIOPermissionAccess.Read
- rootFilePermissions.SetPathList(FileIOPermissionAccess.Read, "C:\\")
-
- ' Add a permission to a named permission set.
- Dim namedPermissions As New NamedPermissionSet("RootPermissions")
- namedPermissions.AddPermission(rootFilePermissions)
-
- ' Create a PolicyStatement with exclusive rights to the policy.
- Dim policy As New PolicyStatement( _
- namedPermissions, _
- PolicyStatementAttribute.Exclusive)
-
- ' Create a FirstMatchCodeGroup with a membership condition that
- ' matches all code, and an exclusive policy.
- Dim codeGroup As New FirstMatchCodeGroup( _
- New AllMembershipCondition, _
- policy)
- '
-
- ' Set the name of the first match code group.
- '
- codeGroup.Name = "TempCodeGroup"
- '
-
- ' Set the description of the first match code group.
- '
- codeGroup.Description = "Temp folder permissions group"
- '
-
- Return codeGroup
- End Function
-
- ' Add file permission to restrict write access to all files
- ' on the local machine.
- Private Sub addPolicy(ByRef codeGroup As FirstMatchCodeGroup)
- ' Set the PolicyStatement property to a policy with read access to the
- ' root directory on drive C.
- '
- Dim rootFilePermissions As New FileIOPermission(PermissionState.None)
- rootFilePermissions.AllLocalFiles = FileIOPermissionAccess.Read
- rootFilePermissions.SetPathList(FileIOPermissionAccess.Read, "C:\\")
-
- Dim namedPermissions As New NamedPermissionSet("RootPermissions")
- namedPermissions.AddPermission(rootFilePermissions)
-
- ' Create a PolicyStatement with exclusive rights to the policy.
- Dim policy As New PolicyStatement( _
- namedPermissions, _
- PolicyStatementAttribute.Exclusive)
-
- codeGroup.PolicyStatement = policy
- '
- End Sub
-
- ' Set the membership condition of the code group.
- Private Sub updateMembershipCondition( _
- ByRef codeGroup As FirstMatchCodeGroup)
-
- ' Set the membership condition of the specified FirstMatchCodeGroup
- ' to the Intranet zone.
- '
- Dim zoneCondition As _
- New ZoneMembershipCondition(SecurityZone.Intranet)
- codeGroup.MembershipCondition = zoneCondition
- '
- End Sub
-
- ' Create a child code group with read-access file permissions and add it
- ' to the specified code group.
- Private Sub addChildCodeGroup(ByRef codegroup As FirstMatchCodeGroup)
- ' Create a first match code group with read access.
- '
- Dim rootFilePermissions As New FileIOPermission(PermissionState.None)
- rootFilePermissions.AllLocalFiles = FileIOPermissionAccess.Read
- rootFilePermissions.SetPathList(FileIOPermissionAccess.Read, "C:\\")
-
- Dim permissions As New PermissionSet(PermissionState.Unrestricted)
- permissions.AddPermission(rootFilePermissions)
-
- Dim tempFolderCodeGroup = New FirstMatchCodeGroup( _
- New AllMembershipCondition, _
- New PolicyStatement(permissions))
-
- ' Set the name of the child code group and add it to the specified
- ' code group.
- tempFolderCodeGroup.Name = "Read-only code group"
- codegroup.AddChild(tempFolderCodeGroup)
- '
- End Sub
-
- ' Compare the two FirstMatchCodeGroups.
- Private Function CompareTwoCodeGroups( _
- ByVal firstCodeGroup As FirstMatchCodeGroup, _
- ByVal secondCodeGroup As FirstMatchCodeGroup) As Boolean
-
- ' Compare the two specified FirstMatchCodeGroups for equality.
- '
- If (firstCodeGroup.Equals(secondCodeGroup)) Then
- '
-
- WriteLine("The two code groups are equal.")
- Return True
- Else
- WriteLine("The two code groups are not equal.")
- Return False
- End If
- End Function
-
- ' Retrieve the resolved policy based on executing evidence found
- ' in the specified code group.
- Private Function ResolveEvidence(ByVal codeGroup As CodeGroup) As String
- Dim policyString As String = "None"
-
- ' Resolve the policy based on the executing assembly's evidence.
- '
- Dim executingAssembly As [Assembly] = Me.GetType().Assembly
- Dim executingEvidence As Evidence
- executingEvidence = executingAssembly.Evidence
-
- Dim policy As PolicyStatement = codeGroup.Resolve(executingEvidence)
- '
-
- If (Not policy Is Nothing) Then
- policyString = policy.ToString()
- End If
-
- Return policyString
- End Function
-
- ' Retrieve the resolved code group based on the evidence from the
- ' specified code group.
- Private Function ResolveGroupToEvidence( _
- ByVal codegroup As FirstMatchCodeGroup) _
- As FirstMatchCodeGroup
-
- ' Resolve matching code groups to the executing assembly.
- '
- Dim executingAssembly As [Assembly] = Me.GetType().Assembly
- Dim evidence As Evidence = executingAssembly.Evidence
- Dim resolvedCodeGroup As CodeGroup
- resolvedCodeGroup = codegroup.ResolveMatchingCodeGroups(Evidence)
- '
-
- Return CType(resolvedCodeGroup, FirstMatchCodeGroup)
- End Function
-
- ' If a domain attribute is not found in the specified FirstMatchCodeGroup,
- ' add a child XML element identifying a custom membership condition.
- Private Sub addXmlMember(ByRef codeGroup As FirstMatchCodeGroup)
- '
- Dim xmlElement As SecurityElement = codeGroup.ToXml()
- '
-
- Dim rootElement As New SecurityElement("CodeGroup")
-
- If (xmlElement.Attribute("domain") Is Nothing) Then
- '
- Dim newElement As New SecurityElement("CustomMembershipCondition")
- newElement.AddAttribute("class", "CustomMembershipCondition")
- newElement.AddAttribute("version", "1")
- newElement.AddAttribute("domain", "contoso.com")
-
- rootElement.AddChild(newElement)
-
- codeGroup.FromXml(rootElement)
- '
- End If
-
- WriteLine("Added a custom membership condition:")
- WriteLine(rootElement.ToString())
- End Sub
-
- ' Print the properties of the specified code group to the console.
- Private Sub PrintCodeGroup(ByVal codeGroup As CodeGroup)
- ' Compare the type of the specified object with the
- ' FirstMatchCodeGroup type.
- '
- If (Not codeGroup.GetType() Is GetType(FirstMatchCodeGroup)) Then
- '
- Throw New ArgumentException( _
- "Expected the FirstMatchCodeGroup type.")
-
- End If
-
- Dim codeGroupName As String = codeGroup.Name
- Dim membershipCondition As String
- membershipCondition = codeGroup.MembershipCondition.ToString()
-
- '
- Dim permissionSetName As String = codeGroup.PermissionSetName
- '
-
- '
- Dim hashCode As Integer = codeGroup.GetHashCode()
- '
-
- Dim mergeLogic As String = ""
- '
- If (codeGroup.MergeLogic.Equals("First Match")) Then
- '
- mergeLogic = "with first-match merge logic"
- End If
-
- ' Retrieve the class path for the FirstMatchCodeGroup.
- '
- Dim firstMatchGroupClass As String = codeGroup.ToString()
- '
-
- Dim attributeString As String = ""
- ' Retrieve the string representation of the FirstMatchCodeGroup's
- ' attributes.
- '
- If (Not codeGroup.AttributeString Is Nothing) Then
- attributeString = codeGroup.AttributeString
- End If
- '
-
- ' Write a summary to the console window.
- WriteLine(vbCrLf + "* " + firstMatchGroupClass + " summary *")
- Write("A FirstMatchCodeGroup named ")
- Write(codeGroupName + mergeLogic)
- Write(" has been created with hash code ")
- WriteLine(hashCode.ToString() + ". ")
-
- Write("This code group contains a " + membershipCondition)
- Write(" membership condition with the ")
- Write(permissionSetName + " permission set. ")
-
- Write("The code group contains the following policy: ")
- Write(ResolveEvidence(codeGroup) + ". ")
- Write("It also contains the following attributes: ")
- WriteLine(attributeString)
-
- Dim childCount As Integer = codeGroup.Children.Count
- If (childCount > 0) Then
- Write("There are " + childCount.ToString())
- WriteLine(" child elements in the code group.")
-
- ' Iterate through the child code groups to display their names
- ' and then remove them from the specified code group.
- For i As Int16 = 0 To childCount - 1 Step 1
- ' Retrieve each child explicitly casted as a
- ' FirstMatchCodeGroup type.
- '
- Dim childCodeGroup As FirstMatchCodeGroup
- childCodeGroup = _
- CType(codeGroup.Children(i), FirstMatchCodeGroup)
- '
-
- Write("Removing the " + childCodeGroup.Name + ".")
- ' Remove the child code group.
- '
- codeGroup.RemoveChild(childCodeGroup)
- '
- Next
-
- WriteLine("")
- Else
- WriteLine("No child code groups were found in this code group.")
- End If
- End Sub
-
- Private Sub WriteLine(ByVal message As String)
- tbxOutput.AppendText(message + vbCrLf)
-
- End Sub
-
- Private Sub Write(ByVal message As String)
- tbxOutput.AppendText(message)
-
- End Sub
-
- ' Event handler for Exit button.
- Private Sub Button2_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button2.Click
-
- Application.Exit()
- End Sub
-#Region " Windows Form Designer generated code "
-
- Public Sub New()
- MyBase.New()
-
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
-
- 'Add any initialization after the InitializeComponent() call
-
- End Sub
-
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
-
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
-
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents Panel2 As System.Windows.Forms.Panel
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents Button1 As System.Windows.Forms.Button
- Friend WithEvents Button2 As System.Windows.Forms.Button
- Friend WithEvents tbxOutput As System.Windows.Forms.RichTextBox
- _
- Private Sub InitializeComponent()
- Me.Panel2 = New System.Windows.Forms.Panel
- Me.Button1 = New System.Windows.Forms.Button
- Me.Button2 = New System.Windows.Forms.Button
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.tbxOutput = New System.Windows.Forms.RichTextBox
- Me.Panel2.SuspendLayout()
- Me.Panel1.SuspendLayout()
- Me.SuspendLayout()
- '
- 'Panel2
- '
- Me.Panel2.Controls.Add(Me.Button1)
- Me.Panel2.Controls.Add(Me.Button2)
- Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.Panel2.DockPadding.All = 20
- Me.Panel2.Location = New System.Drawing.Point(0, 320)
- Me.Panel2.Name = "Panel2"
- Me.Panel2.Size = New System.Drawing.Size(616, 64)
- Me.Panel2.TabIndex = 1
- '
- 'Button1
- '
- Me.Button1.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button1.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button1.Location = New System.Drawing.Point(446, 20)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(75, 24)
- Me.Button1.TabIndex = 2
- Me.Button1.Text = "&Run"
- '
- 'Button2
- '
- Me.Button2.Dock = System.Windows.Forms.DockStyle.Right
- Me.Button2.Font = New System.Drawing.Font( _
- "Microsoft Sans Serif", _
- 9.0!, _
- System.Drawing.FontStyle.Regular, _
- System.Drawing.GraphicsUnit.Point, _
- CType(0, Byte))
- Me.Button2.Location = New System.Drawing.Point(521, 20)
- Me.Button2.Name = "Button2"
- Me.Button2.Size = New System.Drawing.Size(75, 24)
- Me.Button2.TabIndex = 3
- Me.Button2.Text = "E&xit"
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.tbxOutput)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel1.DockPadding.All = 20
- Me.Panel1.Location = New System.Drawing.Point(0, 0)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(616, 320)
- Me.Panel1.TabIndex = 2
- '
- 'tbxOutput
- '
- Me.tbxOutput.AccessibleDescription = _
- "Displays output from application."
- Me.tbxOutput.AccessibleName = "Output textbox."
- Me.tbxOutput.Dock = System.Windows.Forms.DockStyle.Fill
- Me.tbxOutput.Location = New System.Drawing.Point(20, 20)
- Me.tbxOutput.Name = "tbxOutput"
- Me.tbxOutput.Size = New System.Drawing.Size(576, 280)
- Me.tbxOutput.TabIndex = 1
- Me.tbxOutput.Text = "Click the Run button to run the application."
- '
- 'Form1
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
- Me.ClientSize = New System.Drawing.Size(616, 384)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.Panel2)
- Me.Name = "Form1"
- Me.Text = "FirstMatchCodeGroup"
- Me.Panel2.ResumeLayout(False)
- Me.Panel1.ResumeLayout(False)
- Me.ResumeLayout(False)
-
- End Sub
-
-#End Region
-End Class
-'
-' This sample produces the following output:
-'
-' The two code groups are equal.
-' Added a custom membership condition:
-'
-'
-'
-'
-' Comparing the resolved code group with the initial code group.
-' The two code groups are not equal.
-'
-' * System.Security.Policy.FirstMatchCodeGroup summary *
-' A FirstMatchCodeGroup named with first-match merge logic has been created
-' with hash code 113155593. This code group contains a Zone - Intranet
-' membership condition with the permission set. The code group contains the
-' following policy: None. It also contains the following attributes:
-' There are 1 child elements in the code group.
-' Removing the Read-only code group.
-'
-' This sample completed successfully; press Exit to continue.
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.Gac/VB/gac.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.Gac/VB/gac.vb
deleted file mode 100644
index 34dff39aa39..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.Policy.Gac/VB/gac.vb
+++ /dev/null
@@ -1,39 +0,0 @@
-'
-Imports System.Security.Policy
-Imports System.Security
-Imports System.Security.Permissions
-
-Class GacDemo
- _
- Overloads Shared Sub Main(ByVal args() As String)
- '
- Dim myGacInstalled As New GacInstalled
- '
-
- '
- Dim hostEvidence() As Object = {myGacInstalled}
- Dim assemblyEvidence() As Object
- Dim myEvidence As New Evidence(hostEvidence, assemblyEvidence)
- Dim myPerm As GacIdentityPermission = _
- CType(myGacInstalled.CreateIdentityPermission(myEvidence), _
- GacIdentityPermission)
- Console.WriteLine(myPerm.ToXml().ToString())
- '
-
- '
- Dim myGacInstalledCopy As GacInstalled = _
- CType(myGacInstalled.Copy(), GacInstalled)
- Dim result As Boolean = myGacInstalled.Equals(myGacInstalledCopy)
- '
-
- '
- Console.WriteLine( _
- ("Hashcode = " & myGacInstalled.GetHashCode().ToString()))
- '
-
- '
- Console.WriteLine(myGacInstalled.ToString())
- End Sub
- '
-End Class
-'
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.SecurityContext.Run/VB/form1.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.SecurityContext.Run/VB/form1.vb
deleted file mode 100644
index a6d88c224fa..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.SecurityContext.Run/VB/form1.vb
+++ /dev/null
@@ -1,19 +0,0 @@
- '
-Imports System.Security
-Imports System.Threading
-
-
-
-Class Test
-
- Shared Sub Main()
- Dim cCallBack As New ContextCallback(AddressOf Callback)
- SecurityContext.Run(SecurityContext.Capture(), cCallBack, "Hello world.")
- End Sub
-
- Shared Sub Callback(ByVal o As Object)
- Console.WriteLine(o)
-
- End Sub
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_CLR_System/system.security.permissions.principalpermission/vb/remarks.vb b/snippets/visualbasic/VS_Snippets_CLR_System/system.security.permissions.principalpermission/vb/remarks.vb
deleted file mode 100644
index 29cbe68b816..00000000000
--- a/snippets/visualbasic/VS_Snippets_CLR_System/system.security.permissions.principalpermission/vb/remarks.vb
+++ /dev/null
@@ -1,31 +0,0 @@
-Imports System.Security
-Imports System.Security.Policy
-Imports System.Security.Permissions
-
-Public Class PrincipalPermTest
- Public Shared Sub Main()
- Dummy1()
- End Sub
-
- Private Shared Sub Dummy1()
- '
- Dim ppBob As New PrincipalPermission("Bob", "Administrator")
- Dim ppLouise As New PrincipalPermission("Louise", "Administrator")
- Dim pp1 As IPermission = ppBob.Intersect(ppLouise)
- '
- End Sub
-
- Private Shared Sub Dummy2()
- '
- Dim pp1 As IPermission = New PrincipalPermission("", "Administrator")
- '
- End Sub
-
- Private Shared Sub Dummy3()
- '
- Dim ppBob As New PrincipalPermission("Bob", "Administrator")
- Dim ppLouise As New PrincipalPermission("Louise", "Administrator")
- '
- End Sub
-End Class
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/Classic SmtpMail.Send Example/VB/smtpmailsend.vb b/snippets/visualbasic/VS_Snippets_WebNet/Classic SmtpMail.Send Example/VB/smtpmailsend.vb
deleted file mode 100644
index 6afc1119bea..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/Classic SmtpMail.Send Example/VB/smtpmailsend.vb
+++ /dev/null
@@ -1,40 +0,0 @@
-Imports System.Web.Mail
-
-
-Namespace SMTPMailSendExample
- Class Class1
-
- Shared Sub Main()
- Send1()
- Send2()
- End Sub
-
-
- Public Shared Sub Send1()
- '
- Dim myMail As New MailMessage()
- myMail.From = "from@microsoft.com"
- myMail.To = "to@microsoft.com"
- myMail.Subject = "UtilMailMessage001"
- myMail.Priority = MailPriority.Low
- myMail.BodyFormat = MailFormat.Html
- myMail.Body = "UtilMailMessage001 - success"
- Dim myAttachment As New MailAttachment("c:\attach\attach1.txt", MailEncoding.Base64)
- myMail.Attachments.Add(myAttachment)
- SmtpMail.SmtpServer = "MyMailServer"
- SmtpMail.Send(myMail)
- '
- End Sub
-
- Public Shared Sub Send2()
- '
- Dim from As String = "from@microsoft.com"
- Dim mailto As String = "to@microsoft.com"
- Dim subject As String = "UtilMailMessage001"
- Dim body As String = "UtilMailMessage001 - success"
- SmtpMail.SmtpServer = "MyMailServer"
- SmtpMail.Send(from, mailto, subject, body)
- '
- End Sub
- End Class
-End Namespace 'SMTPMailSendExample
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/VB/CustomAspNetClass.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/VB/CustomAspNetClass.vb
deleted file mode 100644
index 073b4f8dfd2..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.AspNetHostingPermission/VB/CustomAspNetClass.vb
+++ /dev/null
@@ -1,9 +0,0 @@
-'
-Imports System.Web
-Imports System.Security.Permissions
-
- _
-Public Class CustomAspNetClass
-
-End Class
-'
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/VB/passportauthentication.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/VB/passportauthentication.vb
deleted file mode 100644
index d77f57e1825..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.PassportAuthentication/VB/passportauthentication.vb
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Imports System.Configuration
-Imports System.Web
-Imports System.Web.Configuration
-
-
-
-
-Class UsingPassportAuthentication
-
-
-Public Sub New()
-'
-' Get the configuration.
-Dim configuration As System.Configuration.Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnetTest")
-
-' Get the authentication section.
-Dim authenticationSection As System.Web.Configuration.AuthenticationSection = CType(configuration.GetSection("system.web/authentication"), System.Web.Configuration.AuthenticationSection)
-
-' Get the authentication passport element.
-Dim passport As PassportAuthentication = authenticationSection.Passport
-
-'
-
-'
-' Create a new passport object.
-Dim newPassport As New PassportAuthentication()
-
-'
-
-'
-' Get the passport redirect URL
-Dim redirectUrl As String = passport.RedirectUrl
-
-' Set the passport redirect Url.
-passport.RedirectUrl = "passportLogin.aspx"
-
-If Not authenticationSection.SectionInformation.IsLocked Then
- configuration.Save()
-End If
-
- '
-
-End Sub
-End Class
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/VB/attachmentsample.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/VB/attachmentsample.vb
deleted file mode 100644
index 07268081fda..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Attachments/VB/attachmentsample.vb
+++ /dev/null
@@ -1,17 +0,0 @@
-Imports System.Web.Mail
-Imports System.Text
-
-
-Namespace AttachmentSample
- Module AttachmentSampleVB
- Public Sub Main(args As string())
- Dim fileName1 As String = args(0)
- Dim fileName2 As String = args(1)
- '
-Dim MyMessage As MailMessage = new MailMessage()
-MyMessage.Attachments.Add(New MailAttachment(fileName1))
-MyMessage.Attachments.Add(New MailAttachment(fileName2, MailEncoding.UUEncode))
- '
- End Sub
- End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/VB/systemwebmailmailmessagebcc.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/VB/systemwebmailmailmessagebcc.vb
deleted file mode 100644
index 71dbd07a131..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Bcc/VB/systemwebmailmailmessagebcc.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.Bcc = "wilma@contoso.com"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/VB/systemwebmailmailmessagebodyencoding.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/VB/systemwebmailmailmessagebodyencoding.vb
deleted file mode 100644
index 34b5e7e779d..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyEncoding/VB/systemwebmailmailmessagebodyencoding.vb
+++ /dev/null
@@ -1,13 +0,0 @@
-Imports System.Web.Mail
-Imports System.Text
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.BodyEncoding = Encoding.ASCII
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/VB/systemwebmailmailmessagebodyformat.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/VB/systemwebmailmailmessagebodyformat.vb
deleted file mode 100644
index 6af085c2cc8..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.BodyFormat/VB/systemwebmailmailmessagebodyformat.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.BodyFormat = MailFormat.Html
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/VB/systemwebmailmailmessagecc.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/VB/systemwebmailmailmessagecc.vb
deleted file mode 100644
index 4ac97acc42d..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Cc/VB/systemwebmailmailmessagecc.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.Cc = "fred@contoso.com"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/VB/systemwebmailmailmessagepriority.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/VB/systemwebmailmailmessagepriority.vb
deleted file mode 100644
index 07b6003ae12..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.Priority/VB/systemwebmailmailmessagepriority.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.Priority = MailPriority.Low
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/VB/systemwebmailmailmessageurlcontentbase.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/VB/systemwebmailmailmessageurlcontentbase.vb
deleted file mode 100644
index 8ca5957d0f2..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.MailMessage.UrlContentBase/VB/systemwebmailmailmessageurlcontentbase.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.UrlContentBase="http://www.contoso.com/Employees"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/VB/systemwebmailsmtpmailsmtpserver.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/VB/systemwebmailsmtpmailsmtpserver.vb
deleted file mode 100644
index e2eb4eb8ef2..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail.SmtpServer/VB/systemwebmailsmtpmailsmtpserver.vb
+++ /dev/null
@@ -1,13 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- ' This example assigns the name of the mail relay server on the
- ' local network to the SmtpServer property.
- SmtpMail.SmtpServer = "RelayServer.Contoso.com"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/VB/systemwebmailsmtpmail.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/VB/systemwebmailsmtpmail.vb
deleted file mode 100644
index 70219d805d6..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Mail.SmtpMail/VB/systemwebmailsmtpmail.vb
+++ /dev/null
@@ -1,53 +0,0 @@
-'
-Imports System.Web.Mail
-
-Namespace SendMail
- Public Class usage
- Public Sub DisplayUsage()
- ' Display usage instructions in case of error.
- Console.WriteLine("Usage SendMail.exe ")
- Console.WriteLine(" the addresses of the email recipients")
- Console.WriteLine(" your email address")
- Console.WriteLine(" subject of your email")
- Console.WriteLine(" the text of the email")
- Console.WriteLine("Example:")
- Console.WriteLine("SendMail.exe SomeOne@contoso.com;SomeOther@contoso.com Me@contoso.com Hi hello")
- End Sub
- End Class
-
- Public Class Start
- ' The main entry point for the application.
- Public Shared Sub Main(ByVal args As String())
- Try
- Try
- Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
- Message.To = args(0)
- Message.From = args(1)
- Message.Subject = args(2)
- Message.Body = args(3)
- Try
- SmtpMail.SmtpServer = "your mail server name goes here"
- SmtpMail.Send(Message)
- Catch ehttp As System.Web.HttpException
- Console.WriteLine("0", ehttp.Message)
- Console.WriteLine("Here is the full error message")
- Console.Write("0", ehttp.ToString())
- End Try
- Catch e As IndexOutOfRangeException
- ' Display usage instructions if error in arguments.
- Dim use As usage = New usage()
- use.DisplayUsage()
- End Try
- Catch e As System.Exception
- ' Display text of unknown error.
- Console.WriteLine("Unknown Exception occurred 0", e.Message)
- Console.WriteLine("Here is the Full Error Message")
- Console.WriteLine("0", e.ToString())
- End Try
- End Sub
- End Class
-End Namespace
-'
-
-
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/Project.vbproj b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/Project.vbproj
deleted file mode 100644
index 007962c868f..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/Project.vbproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Library
- net481
-
-
-
-
-
-
-
-
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/imembershipprovider.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/imembershipprovider.vb
deleted file mode 100644
index b7af1e35dca..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.IMembershipProvider/VB/imembershipprovider.vb
+++ /dev/null
@@ -1,1410 +0,0 @@
-Imports System.Collections.Specialized
-Imports System.Configuration
-Imports System.Configuration.Provider
-Imports System.Data.Odbc
-Imports System.Security.Cryptography
-Imports System.Text
-Imports System.Web.Configuration
-Imports System.Web.Security
-
-
-' This provider works with the following schema for the table of user data.
-'
-' CREATE TABLE Users
-' (
-' PKID Guid NOT NULL PRIMARY KEY,
-' Username Text (255) NOT NULL,
-' ApplicationName Text (255) NOT NULL,
-' Email Text (128) NOT NULL,
-' Comment Text (255),
-' Password Text (128) NOT NULL,
-' PasswordQuestion Text (255),
-' PasswordAnswer Text (128),
-' IsApproved YesNo,
-' LastActivityDate DateTime,
-' LastLoginDate DateTime,
-' LastPasswordChangedDate DateTime,
-' CreationDate DateTime,
-' IsOnLine YesNo,
-' IsLockedOut YesNo,
-' LastLockedOutDate DateTime,
-' FailedPasswordAttemptCount Integer,
-' FailedPasswordAttemptWindowStart DateTime,
-' FailedPasswordAnswerAttemptCount Integer,
-' FailedPasswordAnswerAttemptWindowStart DateTime
-' )
-
-Namespace Samples.AspNet.Membership
-
- Public NotInheritable Class OdbcMembershipProvider
- Inherits MembershipProvider
-
-
- Private newPasswordLength As Integer = 8
-
- '
- ' Used when determining encryption key values.
- '
-
- Private machineKey As MachineKeySection
-
-
- '
- ' Database connection string.
- '
-
- Private pConnectionStringSettings As ConnectionStringSettings
-
- Public ReadOnly Property ConnectionString As String
- Get
- Return pConnectionStringSettings.ConnectionString
- End Get
- End Property
-
-
- '
- ' System.Configuration.Provider.ProviderBase.Initialize Method
- '
-
- Public Overrides Sub Initialize(name As String, config As NameValueCollection)
-
- '
- ' Initialize values from web.config.
- '
-
- If config Is Nothing Then _
- Throw New ArgumentNullException("config")
-
- If name Is Nothing OrElse name.Length = 0 Then _
- name = "OdbcMembershipProvider"
-
- If String.IsNullOrEmpty(config("description")) Then
- config.Remove("description")
- config.Add("description", "Sample ODBC Membership provider")
- End If
-
- ' Initialize the abstract base class.
- MyBase.Initialize(name, config)
-
-
- pApplicationName = GetConfigValue(config("applicationName"),
- System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath)
- pMaxInvalidPasswordAttempts = Convert.ToInt32(GetConfigValue(config("maxInvalidPasswordAttempts"), "5"))
- pPasswordAttemptWindow = Convert.ToInt32(GetConfigValue(config("passwordAttemptWindow"), "10"))
- pMinRequiredNonAlphanumericCharacters = Convert.ToInt32(GetConfigValue(config("minRequiredAlphaNumericCharacters"), "1"))
- pMinRequiredPasswordLength = Convert.ToInt32(GetConfigValue(config("minRequiredPasswordLength"), "7"))
- pPasswordStrengthRegularExpression = Convert.ToString(GetConfigValue(config("passwordStrengthRegularExpression"), ""))
- pEnablePasswordReset = Convert.ToBoolean(GetConfigValue(config("enablePasswordReset"), "True"))
- pEnablePasswordRetrieval = Convert.ToBoolean(GetConfigValue(config("enablePasswordRetrieval"), "True"))
- pRequiresQuestionAndAnswer = Convert.ToBoolean(GetConfigValue(config("requiresQuestionAndAnswer"), "False"))
- pRequiresUniqueEmail = Convert.ToBoolean(GetConfigValue(config("requiresUniqueEmail"), "True"))
-
- Dim temp_format As String = config("passwordFormat")
- If temp_format Is Nothing Then
- temp_format = "Hashed"
- End If
-
- Select Case temp_format
- Case "Hashed"
- pPasswordFormat = MembershipPasswordFormat.Hashed
- Case "Encrypted"
- pPasswordFormat = MembershipPasswordFormat.Encrypted
- Case "Clear"
- pPasswordFormat = MembershipPasswordFormat.Clear
- Case Else
- Throw New ProviderException("Password format not supported.")
- End Select
- '
- ' Initialize OdbcConnection.
- '
-
- pConnectionStringSettings = ConfigurationManager.ConnectionStrings(config("connectionStringName"))
-
- If pConnectionStringSettings Is Nothing OrElse pConnectionStringSettings.ConnectionString.Trim() = "" Then
- Throw New ProviderException("Connection string cannot be blank.")
- End If
-
-
- ' Get encryption and decryption key information from the configuration.
- Dim cfg As System.Configuration.Configuration =
- WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath)
- machineKey = CType(cfg.GetSection("system.web/machineKey"), MachineKeySection)
- End Sub
-
- '
- ' A helper function to retrieve config values from the configuration file.
- '
-
- Private Function GetConfigValue(configValue As String, defaultValue As String) As String
- If configValue Is Nothing OrElse configValue.Trim() = "" Then _
- Return defaultValue
-
- Return configValue
- End Function
-
-
- '
- ' System.Web.Security.MembershipProvider properties.
- '
-
- Private pRequiresUniqueEmail As Boolean
-
- Public Overrides ReadOnly Property RequiresUniqueEmail As Boolean
- Get
- Return pRequiresUniqueEmail
- End Get
- End Property
-
- Private pMaxInvalidPasswordAttempts As Integer
-
- Public Overrides ReadOnly Property MaxInvalidPasswordAttempts As Integer
- Get
- Return pMaxInvalidPasswordAttempts
- End Get
- End Property
-
- Private pPasswordAttemptWindow As Integer
-
- Public Overrides ReadOnly Property PasswordAttemptWindow As Integer
- Get
- Return pPasswordAttemptWindow
- End Get
- End Property
-
- Private pPasswordFormat As MembershipPasswordFormat
-
- Public Overrides ReadOnly Property PasswordFormat As MembershipPasswordFormat
- Get
- Return pPasswordFormat
- End Get
- End Property
-
- Private pMinRequiredNonAlphanumericCharacters As Integer
-
- Public Overrides ReadOnly Property MinRequiredNonAlphanumericCharacters() As Integer
- Get
- Return pMinRequiredNonAlphanumericCharacters
- End Get
- End Property
-
- Private pMinRequiredPasswordLength As Integer
-
- Public Overrides ReadOnly Property MinRequiredPasswordLength() As Integer
- Get
- Return pMinRequiredPasswordLength
- End Get
- End Property
-
- Private pPasswordStrengthRegularExpression As String
-
- Public Overrides ReadOnly Property PasswordStrengthRegularExpression() As String
- Get
- Return pPasswordStrengthRegularExpression
- End Get
- End Property
-
- '
- Private pApplicationName As String
-
- Public Overrides Property ApplicationName As String
- Get
- Return pApplicationName
- End Get
- Set
- pApplicationName = Value
- End Set
- End Property
- '
-
- '
- Private pEnablePasswordReset As Boolean
-
- Public Overrides ReadOnly Property EnablePasswordReset As Boolean
- Get
- Return pEnablePasswordReset
- End Get
- End Property
- '
-
- '
- Private pEnablePasswordRetrieval As Boolean
-
- Public Overrides ReadOnly Property EnablePasswordRetrieval As Boolean
- Get
- Return pEnablePasswordRetrieval
- End Get
- End Property
- '
-
-
- '
- Private pRequiresQuestionAndAnswer As Boolean
-
- Public Overrides ReadOnly Property RequiresQuestionAndAnswer As Boolean
- Get
- Return pRequiresQuestionAndAnswer
- End Get
- End Property
- '
-
-
- '
- ' System.Web.Security.MembershipProvider methods.
- '
-
- '
- ' MembershipProvider.ChangePassword
- '
-
- '
- Public Overrides Function ChangePassword(username As String,
- oldPwd As String,
- newPwd As String) As Boolean
-
- If Not ValidateUser(username, oldPwd) Then
- Return False
- End If
-
- Dim args As ValidatePasswordEventArgs =
- New ValidatePasswordEventArgs(username, newPwd, True)
-
- OnValidatingPassword(args)
-
- If args.Cancel Then
- If Not args.FailureInformation Is Nothing Then
- Throw args.FailureInformation
- Else
- Throw New MembershipPasswordException("Change password canceled due to New password validation failure.")
- End If
- End If
-
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- " SET Password = ?, LastPasswordChangedDate = ? " &
- " WHERE Username = ? AND Password = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 128).Value = EncodePassword(newPwd)
- cmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@OldPassword", OdbcType.VarChar, 128).Value = oldPwd
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
- '
- ' MembershipProvider.ChangePasswordQuestionAndAnswer
- '
-
- '
- Public Overrides Function ChangePasswordQuestionAndAnswer(username As String,
- password As String,
- newPwdQuestion As String,
- newPwdAnswer As String) _
- As Boolean
-
- If Not ValidateUser(username, password) Then Return False
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- " SET PasswordQuestion = ?, PasswordAnswer = ?" &
- " WHERE Username = ? AND Password = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Question", OdbcType.VarChar, 255).Value = newPwdQuestion
- cmd.Parameters.Add("@Answer", OdbcType.VarChar, 255).Value = EncodePassword(newPwdAnswer)
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 128).Value = password
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.CreateUser
- '
-
- '
- Public Overrides Function CreateUser(ByVal username As String,
- ByVal password As String,
- ByVal email As String,
- ByVal passwordQuestion As String,
- ByVal passwordAnswer As String,
- ByVal isApproved As Boolean,
- ByVal providerUserKey As Object,
- ByRef status As MembershipCreateStatus) As MembershipUser
-
- Dim Args As ValidatePasswordEventArgs =
- New ValidatePasswordEventArgs(username, password, True)
-
- OnValidatingPassword(Args)
-
- If Args.Cancel Then
- status = MembershipCreateStatus.InvalidPassword
- Return Nothing
- End If
-
-
- If RequiresUniqueEmail AndAlso GetUserNameByEmail(email) <> "" Then
- status = MembershipCreateStatus.DuplicateEmail
- Return Nothing
- End If
-
- Dim u As MembershipUser = GetUser(username, False)
-
- If u Is Nothing Then
- Dim createDate As DateTime = DateTime.Now
-
- If providerUserKey Is Nothing Then
- providerUserKey = Guid.NewGuid()
- Else
- If Not TypeOf providerUserKey Is Guid Then
- status = MembershipCreateStatus.InvalidProviderUserKey
- Return Nothing
- End If
- End If
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("INSERT INTO Users " &
- " (PKID, Username, Password, Email, PasswordQuestion, " &
- " PasswordAnswer, IsApproved," &
- " Comment, CreationDate, LastPasswordChangedDate, LastActivityDate," &
- " ApplicationName, IsLockedOut, LastLockedOutDate," &
- " FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, " &
- " FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart)" &
- " Values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", conn)
-
- cmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 255).Value = EncodePassword(password)
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = email
- cmd.Parameters.Add("@PasswordQuestion", OdbcType.VarChar, 255).Value = passwordQuestion
- cmd.Parameters.Add("@PasswordAnswer", OdbcType.VarChar, 255).Value = EncodePassword(passwordAnswer)
- cmd.Parameters.Add("@IsApproved", OdbcType.Bit).Value = isApproved
- cmd.Parameters.Add("@Comment", OdbcType.VarChar, 255).Value = ""
- cmd.Parameters.Add("@CreationDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
- cmd.Parameters.Add("@IsLockedOut", OdbcType.Bit).Value = False
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@FailedPasswordAttemptCount", OdbcType.Int).Value = 0
- cmd.Parameters.Add("@FailedPasswordAttemptWindowStart", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@FailedPasswordAnswerAttemptCount", OdbcType.Int).Value = 0
- cmd.Parameters.Add("@FailedPasswordAnswerAttemptWindowStart", OdbcType.DateTime).Value = createDate
-
- Try
- conn.Open()
-
- Dim recAdded As Integer = cmd.ExecuteNonQuery()
-
- If recAdded > 0 Then
- status = MembershipCreateStatus.Success
- Else
- status = MembershipCreateStatus.UserRejected
- End If
- Catch e As OdbcException
- ' Handle exception.
-
- status = MembershipCreateStatus.ProviderError
- Finally
- conn.Close()
- End Try
-
-
- Return GetUser(username, False)
- Else
- status = MembershipCreateStatus.DuplicateUserName
- End If
-
- Return Nothing
- End Function
- '
-
-
-
- '
- ' MembershipProvider.DeleteUser
- '
-
- '
- Public Overrides Function DeleteUser(username As String, deleteAllRelatedData As Boolean) As Boolean
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("DELETE FROM Users " &
- " WHERE Username = ? AND Applicationname = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
-
- If deleteAllRelatedData Then
- ' Process commands to delete all data for the user in the database.
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.GetAllUsers
- '
-
-
- Public Overrides Function GetAllUsers(ByVal pageIndex As Integer,
- ByVal pageSize As Integer,
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " &
- "WHERE ApplicationName = ?", conn)
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," &
- " Comment, IsApproved, CreationDate, LastLoginDate," &
- " LastActivityDate, LastPasswordChangedDate " &
- " FROM Users " &
- " WHERE ApplicationName = ? " &
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
-
-
-
-
-
- '
- ' MembershipProvider.GetNumberOfUsersOnline
- '
-
- '
- Public Overrides Function GetNumberOfUsersOnline() As Integer
-
- Dim onlineSpan As TimeSpan = New TimeSpan(0, System.Web.Security.Membership.UserIsOnlineTimeWindow, 0)
- Dim compareTime As DateTime = DateTime.Now.Subtract(onlineSpan)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " &
- " WHERE LastActivityDate > ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@CompareDate", OdbcType.DateTime).Value = compareTime
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim numOnline As Integer = 0
-
- Try
- conn.Open()
-
- numOnline = CType(cmd.ExecuteScalar(), Integer)
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- Return numOnline
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.GetPassword
- '
-
- '
- Public Overrides Function GetPassword(username As String, answer As String) As String
-
- If Not EnablePasswordRetrieval Then
- Throw New ProviderException("Password Retrieval Not Enabled.")
- End If
-
- If PasswordFormat = MembershipPasswordFormat.Hashed Then
- Throw New ProviderException("Cannot retrieve Hashed passwords.")
- End If
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Password, PasswordAnswer, IsLockedOut FROM Users " &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim password As String = ""
- Dim passwordAnswer As String = ""
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If reader.GetBoolean(2) Then _
- Throw New MembershipPasswordException("The supplied user is locked out.")
-
- password = reader.GetString(0)
- passwordAnswer = reader.GetString(1)
- Else
- Throw New MembershipPasswordException("The supplied user name is not found.")
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
-
- If RequiresQuestionAndAnswer AndAlso Not CheckPassword(answer, passwordAnswer) Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New MembershipPasswordException("Incorrect password answer.")
- End If
-
-
- If PasswordFormat = MembershipPasswordFormat.Encrypted Then
- password = UnEncodePassword(password)
- End If
-
- Return password
- End Function
- '
-
-
-
- '
- ' MembershipProvider.GetUser
- '
-
- '
- Public Overrides Function GetUser(ByVal username As String, ByVal userIsOnline As Boolean) As MembershipUser
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PKID, Username, Email, PasswordQuestion," &
- " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," &
- " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" &
- " FROM Users WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim u As MembershipUser = Nothing
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader()
-
- If reader.HasRows Then
- reader.Read()
- u = GetUserFromReader(reader)
-
- If userIsOnline Then
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- "SET LastActivityDate = ? " &
- "WHERE Username = ? AND Applicationname = ?", conn)
-
- updateCmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- updateCmd.ExecuteNonQuery()
- End If
- End If
- Catch e As OdbcException
- ' Handle Exception
- Finally
- If Not reader Is Nothing Then reader.Close()
-
- conn.Close()
- End Try
-
- Return u
- End Function
-
-
- '
- ' GetUserFromReader
- ' A helper function that takes the current row from the OdbcDataReader
- ' and populates a MembershipUser object with the values. Called by the
- ' MembershipUser.GetUser implementation.
- '
-
- Public Function GetUserFromReader(ByVal reader As OdbcDataReader) As MembershipUser
-
- Dim providerUserKey As Object = reader.GetValue(0)
- Dim username As String = reader.GetString(1)
- Dim email As String = reader.GetString(2)
-
- Dim passwordQuestion As String = ""
- If Not reader.GetValue(3) Is DBNull.Value Then _
- passwordQuestion = reader.GetString(3)
-
- Dim comment As String = ""
- If Not reader.GetValue(4) Is DBNull.Value Then _
- comment = reader.GetString(4)
-
- Dim isApproved As Boolean = reader.GetBoolean(5)
- Dim isLockedOut As Boolean = reader.GetBoolean(6)
- Dim creationDate As DateTime = reader.GetDateTime(7)
-
- Dim lastLoginDate As DateTime = New DateTime()
- If Not reader.GetValue(8) Is DBNull.Value Then _
- lastLoginDate = reader.GetDateTime(8)
-
- Dim lastActivityDate As DateTime = reader.GetDateTime(9)
- Dim lastPasswordChangedDate As DateTime = reader.GetDateTime(10)
-
- Dim lastLockedOutDate As DateTime = New DateTime()
- If Not reader.GetValue(11) Is DBNull.Value Then _
- lastLockedOutDate = reader.GetDateTime(11)
-
- Dim u As MembershipUser = New MembershipUser(Me.Name,
- username,
- providerUserKey,
- email,
- passwordQuestion,
- comment,
- isApproved,
- isLockedOut,
- creationDate,
- lastLoginDate,
- lastActivityDate,
- lastPasswordChangedDate,
- lastLockedOutDate)
-
- Return u
- End Function
- '
-
-
-
- '
- ' MembershipProvider.GetUserNameByEmail
- '
-
- '
- Public Overrides Function GetUserNameByEmail(ByVal email As String) As String
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Username" &
- " FROM Users WHERE Email = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = email
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim username As String = ""
-
- Try
- conn.Open()
-
- username = CType(cmd.ExecuteScalar(), String)
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- Return username
- End Function
- '
-
-
-
-
-
- '
- ' MembershipProvider.ResetPassword
- '
-
-
- '
- Public Overrides Function ResetPassword(username As String, answer As String) As String
-
- If Not EnablePasswordReset Then
- Throw New NotSupportedException("Password Reset is not enabled.")
- End If
-
- If answer Is Nothing AndAlso RequiresQuestionAndAnswer Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New ProviderException("Password answer required for password Reset.")
- End If
-
- Dim newPassword As String =
- System.Web.Security.Membership.GeneratePassword(newPasswordLength, pMinRequiredNonAlphanumericCharacters)
-
-
- Dim Args As ValidatePasswordEventArgs =
- New ValidatePasswordEventArgs(username, newPassword, True)
-
- OnValidatingPassword(Args)
-
- If Args.Cancel Then
- If Not Args.FailureInformation Is Nothing Then
- Throw Args.FailureInformation
- Else
- Throw New MembershipPasswordException("Reset password canceled due to password validation failure.")
- End If
- End If
-
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PasswordAnswer, IsLockedOut FROM Users " &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim rowsAffected As Integer = 0
- Dim passwordAnswer As String = ""
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If reader.GetBoolean(1) Then _
- Throw New MembershipPasswordException("The supplied user is locked out.")
-
- passwordAnswer = reader.GetString(0)
- Else
- Throw New MembershipPasswordException("The supplied user name is not found.")
- End If
-
- If RequiresQuestionAndAnswer AndAlso Not CheckPassword(answer, passwordAnswer) Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New MembershipPasswordException("Incorrect password answer.")
- End If
-
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- " SET Password = ?, LastPasswordChangedDate = ?" &
- " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn)
-
- updateCmd.Parameters.Add("@Password", OdbcType.VarChar, 255).Value = EncodePassword(newPassword)
- updateCmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- rowsAffected = updateCmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then
- Return newPassword
- Else
- Throw New MembershipPasswordException("User not found, or user is locked out. Password not Reset.")
- End If
- End Function
- '
-
-
-
- '
- ' MembershipProvider.UpdateUser
- '
-
- '
- Public Overrides Sub UpdateUser(user As MembershipUser)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- " SET Email = ?, Comment = ?," &
- " IsApproved = ?" &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = user.Email
- cmd.Parameters.Add("@Comment", OdbcType.VarChar, 255).Value = user.Comment
- cmd.Parameters.Add("@IsApproved", OdbcType.Bit).Value = user.IsApproved
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = user.UserName
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Try
- conn.Open()
-
- cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
- End Sub
- '
-
-
-
- '
- ' MembershipProvider.ValidateUser
- '
-
- '
- Public Overrides Function ValidateUser(ByVal username As String, ByVal password As String) As Boolean
-
- Dim isValid As Boolean = False
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Password, IsApproved FROM Users " &
- " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim reader As OdbcDataReader = Nothing
- Dim isApproved As Boolean = False
- Dim pwd As String = ""
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
- pwd = reader.GetString(0)
- isApproved = reader.GetBoolean(1)
- Else
- Return False
- End If
-
- If isApproved AndAlso (password = pwd) Then
- isValid = True
-
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users SET LastLoginDate = ?" &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- updateCmd.Parameters.Add("@LastLoginDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- updateCmd.ExecuteNonQuery()
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return isValid
- End Function
- '
-
-
- Public Overrides Function FindUsersByName(ByVal usernameToMatch As String,
- ByVal pageIndex As Integer,
- ByVal pageSize As Integer,
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " &
- "WHERE Username LIKE ? AND ApplicationName = ?", conn)
- cmd.Parameters.Add("@UsernameSearch", OdbcType.VarChar, 255).Value = usernameToMatch
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," &
- " Comment, IsApproved, CreationDate, LastLoginDate," &
- " LastActivityDate, LastPasswordChangedDate " &
- " FROM Users " &
- " WHERE Username LIKE ? AND ApplicationName = ? " &
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
-
- Public Overrides Function FindUsersByEmail(ByVal emailToMatch As String,
- ByVal pageIndex As Integer,
- ByVal pageSize As Integer,
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " &
- "WHERE Email LIKE ? AND ApplicationName = ?", conn)
- cmd.Parameters.Add("@EmailSearch", OdbcType.VarChar, 255).Value = emailToMatch
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," &
- " Comment, IsApproved, CreationDate, LastLoginDate," &
- " LastActivityDate, LastPasswordChangedDate " &
- " FROM Users " &
- " WHERE Email LIKE ? AND ApplicationName = ? " &
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
- '
- ' MembershipProvider.UnlockUser
- '
-
- Public Overrides Function UnlockUser(ByVal username As String) As Boolean
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- " SET IsLockedOut = False, LastLockedOutDate = ? " &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then _
- Return True
-
- Return False
- End Function
-
-
- '
- ' MembershipProvider.GetUser(Object, Boolean)
- '
-
- Public Overrides Function GetUser(providerUserKey As Object,
- userIsOnline As Boolean) As MembershipUser
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PKID, Username, Email, PasswordQuestion," &
- " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," &
- " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" &
- " FROM Users WHERE PKID = ?", conn)
-
- cmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
-
- Dim u As MembershipUser = Nothing
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader()
-
- If reader.HasRows Then
- reader.Read()
- u = GetUserFromReader(reader)
-
- If userIsOnline Then
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " &
- "SET LastActivityDate = ? " &
- "WHERE PKID = ?", conn)
-
- updateCmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
-
- updateCmd.ExecuteNonQuery()
- End If
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return u
- End Function
-
-
- '
- ' UpdateFailureCount
- ' A helper method that performs the checks and updates associated with
- ' password failure tracking.
- '
-
- Private Sub UpdateFailureCount(username As String, failureType As String)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT FailedPasswordAttemptCount, " &
- " FailedPasswordAttemptWindowStart, " &
- " FailedPasswordAnswerAttemptCount, " &
- " FailedPasswordAnswerAttemptWindowStart " &
- " FROM Users " &
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim reader As OdbcDataReader = Nothing
- Dim windowStart As DateTime = New DateTime()
- Dim failureCount As Integer = 0
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If failureType = "password" Then
- failureCount = reader.GetInt32(0)
- windowStart = reader.GetDateTime(1)
- End If
-
- If failureType = "passwordAnswer" Then
- failureCount = reader.GetInt32(2)
- windowStart = reader.GetDateTime(3)
- End If
- End If
-
- reader.Close()
-
- Dim windowEnd As DateTime = windowStart.AddMinutes(PasswordAttemptWindow)
-
- If failureCount = 0 OrElse DateTime.Now > windowEnd Then
- ' First password failure or outside of PasswordAttemptWindow.
- ' Start a New password failure count from 1 and a New window starting now.
-
- If failureType = "password" Then _
- cmd.CommandText = "UPDATE Users " &
- " SET FailedPasswordAttemptCount = ?, " &
- " FailedPasswordAttemptWindowStart = ? " &
- " WHERE Username = ? AND ApplicationName = ?"
-
- If failureType = "passwordAnswer" Then _
- cmd.CommandText = "UPDATE Users " &
- " SET FailedPasswordAnswerAttemptCount = ?, " &
- " FailedPasswordAnswerAttemptWindowStart = ? " &
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@Count", OdbcType.Int).Value = 1
- cmd.Parameters.Add("@WindowStart", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to update failure count and window start.")
- Else
- failureCount += 1
-
- If failureCount >= MaxInvalidPasswordAttempts Then
- ' Password attempts have exceeded the failure threshold. Lock out
- ' the user.
-
- cmd.CommandText = "UPDATE Users " &
- " SET IsLockedOut = ?, LastLockedOutDate = ? " &
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@IsLockedOut", OdbcType.Bit).Value = True
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to lock out user.")
- Else
- ' Password attempts have not exceeded the failure threshold. Update
- ' the failure counts. Leave the window the same.
-
- If failureType = "password" Then _
- cmd.CommandText = "UPDATE Users " &
- " SET FailedPasswordAttemptCount = ?" &
- " WHERE Username = ? AND ApplicationName = ?"
-
- If failureType = "passwordAnswer" Then _
- cmd.CommandText = "UPDATE Users " &
- " SET FailedPasswordAnswerAttemptCount = ?" &
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@Count", OdbcType.Int).Value = failureCount
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to update failure count.")
- End If
- End If
- Catch e As OdbcException
- ' Handle Exception
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
- End Sub
-
-
- '
- ' CheckPassword
- ' Compares password values based on the MembershipPasswordFormat.
- '
-
- Private Function CheckPassword(password As String, dbpassword As String) As Boolean
- Dim pass1 As String = password
- Dim pass2 As String = dbpassword
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Encrypted
- pass2 = UnEncodePassword(dbpassword)
- Case MembershipPasswordFormat.Hashed
- pass1 = EncodePassword(password)
- Case Else
- End Select
-
- If pass1 = pass2 Then
- Return True
- End If
-
- Return False
- End Function
-
-
- '
- ' EncodePassword
- ' Encrypts, Hashes, or leaves the password clear based on the PasswordFormat.
- '
-
- Private Function EncodePassword(password As String) As String
- Dim encodedPassword As String = password
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Clear
-
- Case MembershipPasswordFormat.Encrypted
- encodedPassword =
- Convert.ToBase64String(EncryptPassword(Encoding.Unicode.GetBytes(password)))
- Case MembershipPasswordFormat.Hashed
- Dim hash As HMACSHA256 = New HMACSHA256()
- hash.Key = HexToByte(machineKey.ValidationKey)
- encodedPassword =
- Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)))
- Case Else
- Throw New ProviderException("Unsupported password format.")
- End Select
-
- Return encodedPassword
- End Function
-
-
- '
- ' UnEncodePassword
- ' Decrypts or leaves the password clear based on the PasswordFormat.
- '
-
- Private Function UnEncodePassword(encodedPassword As String) As String
- Dim password As String = encodedPassword
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Clear
-
- Case MembershipPasswordFormat.Encrypted
- password =
- Encoding.Unicode.GetString(DecryptPassword(Convert.FromBase64String(password)))
- Case MembershipPasswordFormat.Hashed
- Throw New ProviderException("Cannot unencode a hashed password.")
- Case Else
- Throw New ProviderException("Unsupported password format.")
- End Select
-
- Return password
- End Function
-
- '
- ' HexToByte
- ' Converts a hexadecimal string to a byte array. Used to convert encryption
- ' key values from the configuration.
- '
-
- Private Function HexToByte(hexString As String) As Byte()
- Dim ReturnBytes((hexString.Length \ 2) - 1) As Byte
- For i As Integer = 0 To ReturnBytes.Length - 1
- ReturnBytes(i) = Convert.ToByte(hexString.Substring(i * 2, 2), 16)
- Next
- Return ReturnBytes
- End Function
-
-
-
- End Class
-End Namespace
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.MembershipUser.Constructor/VB/newuser.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.MembershipUser.Constructor/VB/newuser.vb
deleted file mode 100644
index a482ca5ceb6..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.MembershipUser.Constructor/VB/newuser.vb
+++ /dev/null
@@ -1,1421 +0,0 @@
-Imports System.Web.Security
-Imports System.Configuration.Provider
-Imports System.Collections.Specialized
-Imports System.Data
-Imports System.Data.Odbc
-Imports System.Configuration
-Imports System.Diagnostics
-Imports System.Web
-Imports System.Globalization
-Imports System.Web.Configuration
-Imports System.Security.Cryptography
-Imports System.Text
-
-
-'
-' This provider works with the following schema for the table of user data.
-'
-' CREATE TABLE Users
-' (
-' PKID Guid NOT NULL PRIMARY KEY,
-' Username Text (255) NOT NULL,
-' ApplicationName Text (255) NOT NULL,
-' Email Text (128) NOT NULL,
-' Comment Text (255),
-' Password Text (128) NOT NULL,
-' PasswordQuestion Text (255),
-' PasswordAnswer Text (128),
-' IsApproved YesNo,
-' LastActivityDate DateTime,
-' LastLoginDate DateTime,
-' LastPasswordChangedDate DateTime,
-' CreationDate DateTime,
-' IsOnLine YesNo,
-' IsLockedOut YesNo,
-' LastLockedOutDate DateTime,
-' FailedPasswordAttemptCount Integer,
-' FailedPasswordAttemptWindowStart DateTime,
-' FailedPasswordAnswerAttemptCount Integer,
-' FailedPasswordAnswerAttemptWindowStart DateTime
-' )
-'
-
-
-Namespace Samples.AspNet.Membership
-
- Public NotInheritable Class OdbcMembershipProvider
- Inherits MembershipProvider
-
-
- Private newPasswordLength As Integer = 8
-
- '
- ' Used when determining encryption key values.
- '
-
- Private machineKey As MachineKeySection
-
-
-
- '
- ' Database connection string.
- '
-
- Private pConnectionStringSettings As ConnectionStringSettings
-
- Public ReadOnly Property ConnectionString() As String
- Get
- Return pConnectionStringSettings.ConnectionString
- End Get
- End Property
-
-
-
-
-
- '
- ' System.Configuration.Provider.ProviderBase.Initialize Method
- '
-
- Public Overrides Sub Initialize(ByVal name As String, ByVal config As NameValueCollection)
-
- '
- ' Initialize values from web.config.
- '
-
- If config Is Nothing Then _
- Throw New ArgumentNullException("config")
-
- If name Is Nothing OrElse name.Length = 0 Then _
- name = "OdbcMembershipProvider"
-
- If String.IsNullOrEmpty(config("description")) Then
- config.Remove("description")
- config.Add("description", "Sample ODBC Membership provider")
- End If
-
- ' Initialize the abstract base class.
- MyBase.Initialize(name, config)
-
-
- pApplicationName = GetConfigValue(config("applicationName"), _
- System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath)
- pMaxInvalidPasswordAttempts = Convert.ToInt32(GetConfigValue(config("maxInvalidPasswordAttempts"), "5"))
- pPasswordAttemptWindow = Convert.ToInt32(GetConfigValue(config("passwordAttemptWindow"), "10"))
- pMinRequiredNonAlphanumericCharacters = Convert.ToInt32(GetConfigValue(config("minRequiredAlphaNumericCharacters"), "1"))
- pMinRequiredPasswordLength = Convert.ToInt32(GetConfigValue(config("minRequiredPasswordLength"), "7"))
- pPasswordStrengthRegularExpression = Convert.ToString(GetConfigValue(config("passwordStrengthRegularExpression"), ""))
- pEnablePasswordReset = Convert.ToBoolean(GetConfigValue(config("enablePasswordReset"), "True"))
- pEnablePasswordRetrieval = Convert.ToBoolean(GetConfigValue(config("enablePasswordRetrieval"), "True"))
- pRequiresQuestionAndAnswer = Convert.ToBoolean(GetConfigValue(config("requiresQuestionAndAnswer"), "False"))
- pRequiresUniqueEmail = Convert.ToBoolean(GetConfigValue(config("requiresUniqueEmail"), "True"))
-
- Dim temp_format As String = config("passwordFormat")
- If temp_format Is Nothing Then
- temp_format = "Hashed"
- End If
-
- Select Case temp_format
- Case "Hashed"
- pPasswordFormat = MembershipPasswordFormat.Hashed
- Case "Encrypted"
- pPasswordFormat = MembershipPasswordFormat.Encrypted
- Case "Clear"
- pPasswordFormat = MembershipPasswordFormat.Clear
- Case Else
- Throw New ProviderException("Password format not supported.")
- End Select
- '
- ' Initialize OdbcConnection.
- '
-
- pConnectionStringSettings = ConfigurationManager.ConnectionStrings(config("connectionStringName"))
-
- If pConnectionStringSettings Is Nothing OrElse pConnectionStringSettings.ConnectionString.Trim() = "" Then
- Throw New ProviderException("Connection string cannot be blank.")
- End If
-
-
- ' Get encryption and decryption key information from the configuration.
- Dim cfg As System.Configuration.Configuration = _
- WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath)
- machineKey = CType(cfg.GetSection("system.web/machineKey"), MachineKeySection)
- End Sub
-
- '
- ' A helper function to retrieve config values from the configuration file.
- '
-
- Private Function GetConfigValue(ByVal configValue As String, ByVal defaultValue As String) As String
- If configValue Is Nothing OrElse configValue.Trim() = "" Then _
- Return defaultValue
-
- Return configValue
- End Function
-
-
- '
- ' System.Web.Security.MembershipProvider properties.
- '
-
- Private pRequiresUniqueEmail As Boolean
-
- Public Overrides ReadOnly Property RequiresUniqueEmail() As Boolean
- Get
- Return pRequiresUniqueEmail
- End Get
- End Property
-
- Private pMaxInvalidPasswordAttempts As Integer
-
- Public Overrides ReadOnly Property MaxInvalidPasswordAttempts() As Integer
- Get
- Return pMaxInvalidPasswordAttempts
- End Get
- End Property
-
- Private pPasswordAttemptWindow As Integer
-
- Public Overrides ReadOnly Property PasswordAttemptWindow() As Integer
- Get
- Return pPasswordAttemptWindow
- End Get
- End Property
-
- Private pPasswordFormat As MembershipPasswordFormat
-
- Public Overrides ReadOnly Property PasswordFormat() As MembershipPasswordFormat
- Get
- Return pPasswordFormat
- End Get
- End Property
-
- Private pMinRequiredNonAlphanumericCharacters As Integer
-
- Public Overrides ReadOnly Property MinRequiredNonAlphanumericCharacters() As Integer
- Get
- Return pMinRequiredNonAlphanumericCharacters
- End Get
- End Property
-
- Private pMinRequiredPasswordLength As Integer
-
- Public Overrides ReadOnly Property MinRequiredPasswordLength() As Integer
- Get
- Return pMinRequiredPasswordLength
- End Get
- End Property
-
- Private pPasswordStrengthRegularExpression As String
-
- Public Overrides ReadOnly Property PasswordStrengthRegularExpression() As String
- Get
- Return pPasswordStrengthRegularExpression
- End Get
- End Property
-
- '
- Private pApplicationName As String
-
- Public Overrides Property ApplicationName() As String
- Get
- Return pApplicationName
- End Get
- Set(ByVal value As String)
- pApplicationName = value
- End Set
- End Property
- '
-
- '
- Private pEnablePasswordReset As Boolean
-
- Public Overrides ReadOnly Property EnablePasswordReset() As Boolean
- Get
- Return pEnablePasswordReSet
- End Get
- End Property
- '
-
- '
- Private pEnablePasswordRetrieval As Boolean
-
- Public Overrides ReadOnly Property EnablePasswordRetrieval() As Boolean
- Get
- Return pEnablePasswordRetrieval
- End Get
- End Property
- '
-
-
- '
- Private pRequiresQuestionAndAnswer As Boolean
-
- Public Overrides ReadOnly Property RequiresQuestionAndAnswer() As Boolean
- Get
- Return pRequiresQuestionAndAnswer
- End Get
- End Property
- '
-
-
- '
- ' System.Web.Security.MembershipProvider methods.
- '
-
- '
- ' MembershipProvider.ChangePassword
- '
-
- '
- Public Overrides Function ChangePassword(ByVal username As String, _
- ByVal oldPwd As String, _
- ByVal newPwd As String) As Boolean
-
- If Not ValidateUser(username, oldPwd) Then
- Return False
- End If
-
- Dim args As ValidatePasswordEventArgs = _
- New ValidatePasswordEventArgs(username, newPwd, True)
-
- OnValidatingPassword(args)
-
- If args.Cancel Then
- If Not args.FailureInformation Is Nothing Then
- Throw args.FailureInformation
- Else
- Throw New MembershipPasswordException("Change password canceled due to New password validation failure.")
- End If
- End If
-
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- " SET Password = ?, LastPasswordChangedDate = ? " & _
- " WHERE Username = ? AND Password = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 128).Value = EncodePassword(newPwd)
- cmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@OldPassword", OdbcType.VarChar, 128).Value = oldPwd
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
- '
- ' MembershipProvider.ChangePasswordQuestionAndAnswer
- '
-
- '
- Public Overrides Function ChangePasswordQuestionAndAnswer(ByVal username As String, _
- ByVal password As String, _
- ByVal newPwdQuestion As String, _
- ByVal newPwdAnswer As String) _
- As Boolean
-
- If Not ValidateUser(username, password) Then Return False
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- " SET PasswordQuestion = ?, PasswordAnswer = ?" & _
- " WHERE Username = ? AND Password = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Question", OdbcType.VarChar, 255).Value = newPwdQuestion
- cmd.Parameters.Add("@Answer", OdbcType.VarChar, 255).Value = EncodePassword(newPwdAnswer)
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 128).Value = password
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.CreateUser
- '
-
- '
- Public Overrides Function CreateUser(ByVal username As String, _
- ByVal password As String, _
- ByVal email As String, _
- ByVal passwordQuestion As String, _
- ByVal passwordAnswer As String, _
- ByVal isApproved As Boolean, _
- ByVal providerUserKey As Object, _
- ByRef status As MembershipCreateStatus) As MembershipUser
-
- Dim Args As ValidatePasswordEventArgs = _
- New ValidatePasswordEventArgs(username, password, True)
-
- OnValidatingPassword(args)
-
- If args.Cancel Then
- status = MembershipCreateStatus.InvalidPassword
- Return Nothing
- End If
-
-
- If RequiresUniqueEmail AndAlso GetUserNameByEmail(email) <> "" Then
- status = MembershipCreateStatus.DuplicateEmail
- Return Nothing
- End If
-
- Dim u As MembershipUser = GetUser(username, False)
-
- If u Is Nothing Then
- Dim createDate As DateTime = DateTime.Now
-
- If providerUserKey Is Nothing Then
- providerUserKey = Guid.NewGuid()
- Else
- If Not TypeOf providerUserKey Is Guid Then
- status = MembershipCreateStatus.InvalidProviderUserKey
- Return Nothing
- End If
- End If
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("INSERT INTO Users " & _
- " (PKID, Username, Password, Email, PasswordQuestion, " & _
- " PasswordAnswer, IsApproved," & _
- " Comment, CreationDate, LastPasswordChangedDate, LastActivityDate," & _
- " ApplicationName, IsLockedOut, LastLockedOutDate," & _
- " FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, " & _
- " FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart)" & _
- " Values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", conn)
-
- cmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@Password", OdbcType.VarChar, 255).Value = EncodePassword(password)
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = email
- cmd.Parameters.Add("@PasswordQuestion", OdbcType.VarChar, 255).Value = passwordQuestion
- cmd.Parameters.Add("@PasswordAnswer", OdbcType.VarChar, 255).Value = EncodePassword(passwordAnswer)
- cmd.Parameters.Add("@IsApproved", OdbcType.Bit).Value = isApproved
- cmd.Parameters.Add("@Comment", OdbcType.VarChar, 255).Value = ""
- cmd.Parameters.Add("@CreationDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
- cmd.Parameters.Add("@IsLockedOut", OdbcType.Bit).Value = False
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@FailedPasswordAttemptCount", OdbcType.Int).Value = 0
- cmd.Parameters.Add("@FailedPasswordAttemptWindowStart", OdbcType.DateTime).Value = createDate
- cmd.Parameters.Add("@FailedPasswordAnswerAttemptCount", OdbcType.Int).Value = 0
- cmd.Parameters.Add("@FailedPasswordAnswerAttemptWindowStart", OdbcType.DateTime).Value = createDate
-
- Try
- conn.Open()
-
- Dim recAdded As Integer = cmd.ExecuteNonQuery()
-
- If recAdded > 0 Then
- status = MembershipCreateStatus.Success
- Else
- status = MembershipCreateStatus.UserRejected
- End If
- Catch e As OdbcException
- ' Handle exception.
-
- status = MembershipCreateStatus.ProviderError
- Finally
- conn.Close()
- End Try
-
-
- Return GetUser(username, False)
- Else
- status = MembershipCreateStatus.DuplicateUserName
- End If
-
- Return Nothing
- End Function
- '
-
-
-
- '
- ' MembershipProvider.DeleteUser
- '
-
- '
- Public Overrides Function DeleteUser(ByVal username As String, ByVal deleteAllRelatedData As Boolean) As Boolean
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("DELETE FROM Users " & _
- " WHERE Username = ? AND Applicationname = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
-
- If deleteAllRelatedData Then
- ' Process commands to delete all data for the user in the database.
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then Return True
-
- Return False
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.GetAllUsers
- '
-
-
- Public Overrides Function GetAllUsers(ByVal pageIndex As Integer, _
- ByVal pageSize As Integer, _
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " & _
- "WHERE ApplicationName = ?", conn)
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," & _
- " Comment, IsApproved, CreationDate, LastLoginDate," & _
- " LastActivityDate, LastPasswordChangedDate " & _
- " FROM Users " & _
- " WHERE ApplicationName = ? " & _
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
-
-
-
-
-
- '
- ' MembershipProvider.GetNumberOfUsersOnline
- '
-
- '
- Public Overrides Function GetNumberOfUsersOnline() As Integer
-
- Dim onlineSpan As TimeSpan = New TimeSpan(0, System.Web.Security.Membership.UserIsOnlineTimeWindow, 0)
- Dim compareTime As DateTime = DateTime.Now.Subtract(onlineSpan)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " & _
- " WHERE LastActivityDate > ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@CompareDate", OdbcType.DateTime).Value = compareTime
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim numOnline As Integer = 0
-
- Try
- conn.Open()
-
- numOnline = CType(cmd.ExecuteScalar(), Integer)
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- Return numOnline
- End Function
- '
-
-
-
-
- '
- ' MembershipProvider.GetPassword
- '
-
- '
- Public Overrides Function GetPassword(ByVal username As String, ByVal answer As String) As String
-
- If Not EnablePasswordRetrieval Then
- Throw New ProviderException("Password Retrieval Not Enabled.")
- End If
-
- If PasswordFormat = MembershipPasswordFormat.Hashed Then
- Throw New ProviderException("Cannot retrieve Hashed passwords.")
- End If
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Password, PasswordAnswer, IsLockedOut FROM Users " & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim password As String = ""
- Dim passwordAnswer As String = ""
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If reader.GetBoolean(2) Then _
- Throw New MembershipPasswordException("The supplied user is locked out.")
-
- password = reader.GetString(0)
- passwordAnswer = reader.GetString(1)
- Else
- Throw New MembershipPasswordException("The supplied user name is not found.")
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
-
- If RequiresQuestionAndAnswer AndAlso Not CheckPassword(answer, passwordAnswer) Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New MembershipPasswordException("Incorrect password answer.")
- End If
-
-
- If PasswordFormat = MembershipPasswordFormat.Encrypted Then
- password = UnEncodePassword(password)
- End If
-
- Return password
- End Function
- '
-
-
-
- '
- ' MembershipProvider.GetUser
- '
-
- '
- Public Overrides Function GetUser(ByVal username As String, ByVal userIsOnline As Boolean) As MembershipUser
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PKID, Username, Email, PasswordQuestion," & _
- " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," & _
- " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" & _
- " FROM Users WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim u As MembershipUser = Nothing
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader()
-
- If reader.HasRows Then
- reader.Read()
- u = GetUserFromReader(reader)
-
- If userIsOnline Then
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- "SET LastActivityDate = ? " & _
- "WHERE Username = ? AND Applicationname = ?", conn)
-
- updateCmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- updateCmd.ExecuteNonQuery()
- End If
- End If
- Catch e As OdbcException
- ' Handle Exception
- Finally
- If Not reader Is Nothing Then reader.Close()
-
- conn.Close()
- End Try
-
- Return u
- End Function
-
-
- '
- ' GetUserFromReader
- ' A helper function that takes the current row from the OdbcDataReader
- ' and populates a MembershipUser object with the values. Called by the
- ' MembershipUser.GetUser implementation.
- '
-
- Public Function GetUserFromReader(ByVal reader As OdbcDataReader) As MembershipUser
-
- Dim providerUserKey As Object = reader.GetValue(0)
- Dim username As String = reader.GetString(1)
- Dim email As String = reader.GetString(2)
-
- Dim passwordQuestion As String = ""
- If Not reader.GetValue(3) Is DBNull.Value Then _
- passwordQuestion = reader.GetString(3)
-
- Dim comment As String = ""
- If Not reader.GetValue(4) Is DBNull.Value Then _
- comment = reader.GetString(4)
-
- Dim isApproved As Boolean = reader.GetBoolean(5)
- Dim isLockedOut As Boolean = reader.GetBoolean(6)
- Dim creationDate As DateTime = reader.GetDateTime(7)
-
- Dim lastLoginDate As DateTime = New DateTime()
- If Not reader.GetValue(8) Is DBNull.Value Then _
- lastLoginDate = reader.GetDateTime(8)
-
- Dim lastActivityDate As DateTime = reader.GetDateTime(9)
- Dim lastPasswordChangedDate As DateTime = reader.GetDateTime(10)
-
- Dim lastLockedOutDate As DateTime = New DateTime()
- If Not reader.GetValue(11) Is DBNull.Value Then _
- lastLockedOutDate = reader.GetDateTime(11)
-
- Dim u As MembershipUser = New MembershipUser(Me.Name, _
- username, _
- providerUserKey, _
- email, _
- passwordQuestion, _
- comment, _
- isApproved, _
- isLockedOut, _
- creationDate, _
- lastLoginDate, _
- lastActivityDate, _
- lastPasswordChangedDate, _
- lastLockedOutDate)
-
- Return u
- End Function
- '
-
-
-
- '
- ' MembershipProvider.GetUserNameByEmail
- '
-
- '
- Public Overrides Function GetUserNameByEmail(ByVal email As String) As String
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Username" & _
- " FROM Users WHERE Email = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = email
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim username As String = ""
-
- Try
- conn.Open()
-
- username = CType(cmd.ExecuteScalar(), String)
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- Return username
- End Function
- '
-
-
-
-
-
- '
- ' MembershipProvider.ResetPassword
- '
-
-
- '
- Public Overrides Function ResetPassword(ByVal username As String, ByVal answer As String) As String
-
- If Not EnablePasswordReset Then
- Throw New NotSupportedException("Password Reset is not enabled.")
- End If
-
- If answer Is Nothing AndAlso RequiresQuestionAndAnswer Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New ProviderException("Password answer required for password Reset.")
- End If
-
- Dim newPassword As String = _
- System.Web.Security.Membership.GeneratePassword(newPasswordLength, pMinRequiredNonAlphanumericCharacters)
-
-
- Dim Args As ValidatePasswordEventArgs = _
- New ValidatePasswordEventArgs(username, newPassword, True)
-
- OnValidatingPassword(args)
-
- If args.Cancel Then
- If Not args.FailureInformation Is Nothing Then
- Throw args.FailureInformation
- Else
- Throw New MembershipPasswordException("Reset password canceled due to password validation failure.")
- End If
- End If
-
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PasswordAnswer, IsLockedOut FROM Users " & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim rowsAffected As Integer = 0
- Dim passwordAnswer As String = ""
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If reader.GetBoolean(1) Then _
- Throw New MembershipPasswordException("The supplied user is locked out.")
-
- passwordAnswer = reader.GetString(0)
- Else
- Throw New MembershipPasswordException("The supplied user name is not found.")
- End If
-
- If RequiresQuestionAndAnswer AndAlso Not CheckPassword(answer, passwordAnswer) Then
- UpdateFailureCount(username, "passwordAnswer")
-
- Throw New MembershipPasswordException("Incorrect password answer.")
- End If
-
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- " SET Password = ?, LastPasswordChangedDate = ?" & _
- " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn)
-
- updateCmd.Parameters.Add("@Password", OdbcType.VarChar, 255).Value = EncodePassword(newPassword)
- updateCmd.Parameters.Add("@LastPasswordChangedDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- rowsAffected = updateCmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then
- Return newPassword
- Else
- Throw New MembershipPasswordException("User not found, or user is locked out. Password not Reset.")
- End If
- End Function
- '
-
-
-
- '
- ' MembershipProvider.UpdateUser
- '
-
- '
- Public Overrides Sub UpdateUser(ByVal user As MembershipUser)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- " SET Email = ?, Comment = ?," & _
- " IsApproved = ?" & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Email", OdbcType.VarChar, 128).Value = user.Email
- cmd.Parameters.Add("@Comment", OdbcType.VarChar, 255).Value = user.Comment
- cmd.Parameters.Add("@IsApproved", OdbcType.Bit).Value = user.IsApproved
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = user.UserName
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
-
- Try
- conn.Open()
-
- cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
- End Sub
- '
-
-
-
- '
- ' MembershipProvider.ValidateUser
- '
-
- '
- Public Overrides Function ValidateUser(ByVal username As String, ByVal password As String) As Boolean
-
- Dim isValid As Boolean = False
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Password, IsApproved FROM Users " & _
- " WHERE Username = ? AND ApplicationName = ? AND IsLockedOut = False", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim reader As OdbcDataReader = Nothing
- Dim isApproved As Boolean = False
- Dim pwd As String = ""
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
- pwd = reader.GetString(0)
- isApproved = reader.GetBoolean(1)
- Else
- Return False
- End If
-
- If isApproved AndAlso (password = pwd) Then
- isValid = True
-
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users SET LastLoginDate = ?" & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- updateCmd.Parameters.Add("@LastLoginDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- updateCmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- updateCmd.ExecuteNonQuery()
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return isValid
- End Function
- '
-
-
- Public Overrides Function FindUsersByName(ByVal usernameToMatch As String, _
- ByVal pageIndex As Integer, _
- ByVal pageSize As Integer, _
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " & _
- "WHERE Username LIKE ? AND ApplicationName = ?", conn)
- cmd.Parameters.Add("@UsernameSearch", OdbcType.VarChar, 255).Value = usernameToMatch
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," & _
- " Comment, IsApproved, CreationDate, LastLoginDate," & _
- " LastActivityDate, LastPasswordChangedDate " & _
- " FROM Users " & _
- " WHERE Username LIKE ? AND ApplicationName = ? " & _
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
-
- Public Overrides Function FindUsersByEmail(ByVal emailToMatch As String, _
- ByVal pageIndex As Integer, _
- ByVal pageSize As Integer, _
- ByRef totalRecords As Integer) _
- As MembershipUserCollection
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT Count(*) FROM Users " & _
- "WHERE Email LIKE ? AND ApplicationName = ?", conn)
- cmd.Parameters.Add("@EmailSearch", OdbcType.VarChar, 255).Value = emailToMatch
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = ApplicationName
-
- Dim users As MembershipUserCollection = New MembershipUserCollection()
-
- Dim reader As OdbcDataReader = Nothing
- totalRecords = 0
-
- Try
- conn.Open()
- totalRecords = CType(cmd.ExecuteScalar(), Integer)
-
- If totalRecords <= 0 Then Return users
-
- cmd.CommandText = "SELECT Username, Email, PasswordQuestion," & _
- " Comment, IsApproved, CreationDate, LastLoginDate," & _
- " LastActivityDate, LastPasswordChangedDate " & _
- " FROM Users " & _
- " WHERE Email LIKE ? AND ApplicationName = ? " & _
- " ORDER BY Username Asc"
-
- reader = cmd.ExecuteReader()
-
- Dim counter As Integer = 0
- Dim startIndex As Integer = pageSize * pageIndex
- Dim endIndex As Integer = startIndex + pageSize - 1
-
- Do While reader.Read()
- If counter >= startIndex Then
- Dim u As MembershipUser = GetUserFromReader(reader)
- users.Add(u)
- End If
-
- If counter >= endIndex Then cmd.Cancel()
-
- counter += 1
- Loop
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return users
- End Function
-
- '
- ' MembershipProvider.UnlockUser
- '
-
- Public Overrides Function UnlockUser(ByVal username As String) As Boolean
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- " SET IsLockedOut = False, LastLockedOutDate = ? " & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim rowsAffected As Integer = 0
-
- Try
- conn.Open()
-
- rowsAffected = cmd.ExecuteNonQuery()
- Catch e As OdbcException
- ' Handle exception.
- Finally
- conn.Close()
- End Try
-
- If rowsAffected > 0 Then _
- Return True
-
- Return False
- End Function
-
-
- '
- ' MembershipProvider.GetUser(Object, Boolean)
- '
-
- Public Overrides Function GetUser(ByVal providerUserKey As Object, _
- ByVal userIsOnline As Boolean) As MembershipUser
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT PKID, Username, Email, PasswordQuestion," & _
- " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," & _
- " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" & _
- " FROM Users WHERE PKID = ?", conn)
-
- cmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
-
- Dim u As MembershipUser = Nothing
- Dim reader As OdbcDataReader = Nothing
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader()
-
- If reader.HasRows Then
- reader.Read()
- u = GetUserFromReader(reader)
-
- If userIsOnline Then
- Dim updateCmd As OdbcCommand = New OdbcCommand("UPDATE Users " & _
- "SET LastActivityDate = ? " & _
- "WHERE PKID = ?", conn)
-
- updateCmd.Parameters.Add("@LastActivityDate", OdbcType.DateTime).Value = DateTime.Now
- updateCmd.Parameters.Add("@PKID", OdbcType.UniqueIdentifier).Value = providerUserKey
-
- updateCmd.ExecuteNonQuery()
- End If
- End If
- Catch e As OdbcException
- ' Handle exception.
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
-
- Return u
- End Function
-
-
- '
- ' UpdateFailureCount
- ' A helper method that performs the checks and updates associated with
- ' password failure tracking.
- '
-
- Private Sub UpdateFailureCount(ByVal username As String, ByVal failureType As String)
-
- Dim conn As OdbcConnection = New OdbcConnection(ConnectionString)
- Dim cmd As OdbcCommand = New OdbcCommand("SELECT FailedPasswordAttemptCount, " & _
- " FailedPasswordAttemptWindowStart, " & _
- " FailedPasswordAnswerAttemptCount, " & _
- " FailedPasswordAnswerAttemptWindowStart " & _
- " FROM Users " & _
- " WHERE Username = ? AND ApplicationName = ?", conn)
-
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- Dim reader As OdbcDataReader = Nothing
- Dim windowStart As DateTime = New DateTime()
- Dim failureCount As Integer = 0
-
- Try
- conn.Open()
-
- reader = cmd.ExecuteReader(CommandBehavior.SingleRow)
-
- If reader.HasRows Then
- reader.Read()
-
- If failureType = "password" Then
- failureCount = reader.GetInt32(0)
- windowStart = reader.GetDateTime(1)
- End If
-
- If failureType = "passwordAnswer" Then
- failureCount = reader.GetInt32(2)
- windowStart = reader.GetDateTime(3)
- End If
- End If
-
- reader.Close()
-
- Dim windowEnd As DateTime = windowStart.AddMinutes(PasswordAttemptWindow)
-
- If failureCount = 0 OrElse DateTime.Now > windowEnd Then
- ' First password failure or outside of PasswordAttemptWindow.
- ' Start a New password failure count from 1 and a New window starting now.
-
- If failureType = "password" Then _
- cmd.CommandText = "UPDATE Users " & _
- " SET FailedPasswordAttemptCount = ?, " & _
- " FailedPasswordAttemptWindowStart = ? " & _
- " WHERE Username = ? AND ApplicationName = ?"
-
- If failureType = "passwordAnswer" Then _
- cmd.CommandText = "UPDATE Users " & _
- " SET FailedPasswordAnswerAttemptCount = ?, " & _
- " FailedPasswordAnswerAttemptWindowStart = ? " & _
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@Count", OdbcType.Int).Value = 1
- cmd.Parameters.Add("@WindowStart", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to update failure count and window start.")
- Else
- failureCount += 1
-
- If failureCount >= MaxInvalidPasswordAttempts Then
- ' Password attempts have exceeded the failure threshold. Lock out
- ' the user.
-
- cmd.CommandText = "UPDATE Users " & _
- " SET IsLockedOut = ?, LastLockedOutDate = ? " & _
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@IsLockedOut", OdbcType.Bit).Value = True
- cmd.Parameters.Add("@LastLockedOutDate", OdbcType.DateTime).Value = DateTime.Now
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to lock out user.")
- Else
- ' Password attempts have not exceeded the failure threshold. Update
- ' the failure counts. Leave the window the same.
-
- If failureType = "password" Then _
- cmd.CommandText = "UPDATE Users " & _
- " SET FailedPasswordAttemptCount = ?" & _
- " WHERE Username = ? AND ApplicationName = ?"
-
- If failureType = "passwordAnswer" Then _
- cmd.CommandText = "UPDATE Users " & _
- " SET FailedPasswordAnswerAttemptCount = ?" & _
- " WHERE Username = ? AND ApplicationName = ?"
-
- cmd.Parameters.Clear()
-
- cmd.Parameters.Add("@Count", OdbcType.Int).Value = failureCount
- cmd.Parameters.Add("@Username", OdbcType.VarChar, 255).Value = username
- cmd.Parameters.Add("@ApplicationName", OdbcType.VarChar, 255).Value = pApplicationName
-
- If cmd.ExecuteNonQuery() < 0 Then _
- Throw New Exception("Unable to update failure count.")
- End If
- End If
- Catch e As OdbcException
- ' Handle Exception
- Finally
- If Not reader Is Nothing Then reader.Close()
- conn.Close()
- End Try
- End Sub
-
-
- '
- ' CheckPassword
- ' Compares password values based on the MembershipPasswordFormat.
- '
-
- Private Function CheckPassword(ByVal password As String, ByVal dbpassword As String) As Boolean
- Dim pass1 As String = password
- Dim pass2 As String = dbpassword
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Encrypted
- pass2 = UnEncodePassword(dbpassword)
- Case MembershipPasswordFormat.Hashed
- pass1 = EncodePassword(password)
- Case Else
- End Select
-
- If pass1 = pass2 Then
- Return True
- End If
-
- Return False
- End Function
-
-
- '
- ' EncodePassword
- ' Encrypts, Hashes, or leaves the password clear based on the PasswordFormat.
- '
-
- Private Function EncodePassword(ByVal password As String) As String
- Dim encodedPassword As String = password
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Clear
-
- Case MembershipPasswordFormat.Encrypted
- encodedPassword = _
- Convert.ToBase64String(EncryptPassword(Encoding.Unicode.GetBytes(password)))
- Case MembershipPasswordFormat.Hashed
- Dim hash As HMACSHA256 = New HMACSHA256()
- hash.Key = HexToByte(machineKey.ValidationKey)
- encodedPassword = _
- Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)))
- Case Else
- Throw New ProviderException("Unsupported password format.")
- End Select
-
- Return encodedPassword
- End Function
-
-
- '
- ' UnEncodePassword
- ' Decrypts or leaves the password clear based on the PasswordFormat.
- '
-
- Private Function UnEncodePassword(ByVal encodedPassword As String) As String
- Dim password As String = encodedPassword
-
- Select Case PasswordFormat
- Case MembershipPasswordFormat.Clear
-
- Case MembershipPasswordFormat.Encrypted
- password = _
- Encoding.Unicode.GetString(DecryptPassword(Convert.FromBase64String(password)))
- Case MembershipPasswordFormat.Hashed
- Throw New ProviderException("Cannot unencode a hashed password.")
- Case Else
- Throw New ProviderException("Unsupported password format.")
- End Select
-
- Return password
- End Function
-
- '
- ' HexToByte
- ' Converts a hexadecimal string to a byte array. Used to convert encryption
- ' key values from the configuration.
- '
-
- Private Function HexToByte(ByVal hexString As String) As Byte()
- Dim ReturnBytes(hexString.Length \ 2) As Byte
- For i As Integer = 0 To ReturnBytes.Length - 1
- ReturnBytes(i) = Convert.ToByte(hexString.Substring(i * 2, 2), 16)
- Next
- Return ReturnBytes
- End Function
-
-
-
- End Class
-End Namespace
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/VB/passportidentity_authurl.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/VB/passportidentity_authurl.vb
deleted file mode 100644
index 3ac5f1a3f1d..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl/VB/passportidentity_authurl.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Declare and set myURL variable = the URL of the appropriate Passport SignIn/SignOut Authority.
-Dim myURL As String = newPass.AuthUrl()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/VB/passportidentity_authurl2.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/VB/passportidentity_authurl2.vb
deleted file mode 100644
index 3ac5f1a3f1d..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.AuthUrl2/VB/passportidentity_authurl2.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Declare and set myURL variable = the URL of the appropriate Passport SignIn/SignOut Authority.
-Dim myURL As String = newPass.AuthUrl()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/VB/passportidentity_getdomainfrommembername.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/VB/passportidentity_getdomainfrommembername.vb
deleted file mode 100644
index 9f8013c2a6a..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.GetDomainFromMemberName/VB/passportidentity_getdomainfrommembername.vb
+++ /dev/null
@@ -1,20 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Get the URL for the Passport Information page using the
-' GetDomainAttribute(attributeName, LocaleID, Domain) method.
-' LocaleID 1033 = English-USA
-' Create a string with the name of the Passport domain associated with the current UserName.
-Dim sPassportDomain As String = newPass.GetDomainFromMemberName(newPass.Name)
-Dim sInfoURL As String = newPass.GetDomainAttribute("PassportInformationCenter", 1033, sPassportDomain)
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/VB/passportidentity_hassavedpassword.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/VB/passportidentity_hassavedpassword.vb
deleted file mode 100644
index 1aaac80c8b7..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.HasSavedPassword/VB/passportidentity_hassavedpassword.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Create a string variable that indicates whether the user has a valid Passport ticket.
-Dim sHasTick As String = newPass.HasTicket.ToString()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/VB/passportidentity_isauthenticated.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/VB/passportidentity_isauthenticated.vb
deleted file mode 100644
index 708d84088b3..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.IsAuthenticated/VB/passportidentity_isauthenticated.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Set the string sIsAuth to the users SignIn status (a boolean) converted to a string.
-Dim sIsAuth As String = newPass.IsAuthenticated.ToString()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/VB/passportidentity_logotag.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/VB/passportidentity_logotag.vb
deleted file mode 100644
index caf3618b980..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag/VB/passportidentity_logotag.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Set a string to the URL of the appropriate Passport
-' SignIn/SignOut Authority.
-Dim sPassportlink As String = newPass.LogoTag()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/VB/passportidentity_logotag2.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/VB/passportidentity_logotag2.vb
deleted file mode 100644
index 39126e92c56..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.LogoTag2/VB/passportidentity_logotag2.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Set a string to the URL of the appropriate Passport
-' SignIn/SignOut Authority.
-Dim sPassportlink As String = newPass.LogoTag2()
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/VB/passportidentity_name.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/VB/passportidentity_name.vb
deleted file mode 100644
index ef62db5544c..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.Name/VB/passportidentity_name.vb
+++ /dev/null
@@ -1,15 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Set a string variable to the Passport member name from the cookie.
-Dim sMemberName As String = newPass.Name
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/VB/passportidentity_signout.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/VB/passportidentity_signout.vb
deleted file mode 100644
index d8d2edfc509..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.SignOut/VB/passportidentity_signout.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' This example demonstrates how to sign a user out of Passport.
-' local GIF file that the user is redirected to.
-Dim signOutGifFile As String = "signout.gif"
-' Signs the user out of their Passport Profile and displays the SignOut.gif file.
-System.Web.Security.PassportIdentity.SignOut(signOutGifFile)
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/VB/passportidentity_ticketage.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/VB/passportidentity_ticketage.vb
deleted file mode 100644
index 7dfc1aa4006..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TicketAge/VB/passportidentity_ticketage.vb
+++ /dev/null
@@ -1,16 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Build a string with the elapsed time since the user's ticket was last refreshed
-' with the Passport Authority.
-Dim sElapsedTime As String = "Elapsed time since ticket refresh: " + newPass.TicketAge.ToString() + " seconds."
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/VB/passportidentity_timesincesignin.vb b/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/VB/passportidentity_timesincesignin.vb
deleted file mode 100644
index 0efb6e8d515..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Security.PassportIdentity.TimeSinceSignIn/VB/passportidentity_timesincesignin.vb
+++ /dev/null
@@ -1,15 +0,0 @@
-Imports System.Web.Security
-
-Namespace myPassportExamples
-public class myPassportIdentity
-public sub Main()
-'
-' Declare new PassportIdendity object as variable newPass.
-Dim newPass As System.Web.Security.PassportIdentity = New System.Web.Security.PassportIdentity()
-' Build a string with the elapsed time since the user last signed in with the Passport Authority.
-Dim sElapsedTimeSignIn As String = "Elapsed time since SignIn: " + newPass.TimeSinceSignIn.ToString() + " seconds."
-'
-End Sub
-End Class
-End Namespace
-
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailAttachment/VB/systemwebmailmailattachment.vb b/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailAttachment/VB/systemwebmailmailattachment.vb
deleted file mode 100644
index a8004da4805..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailAttachment/VB/systemwebmailmailattachment.vb
+++ /dev/null
@@ -1,26 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- 'This example shows how to programmatically add attachments
- 'to a mail lessage.
-
- Dim MyMail As MailMessage = New MailMessage()
- Dim iLoop1 As integer
-
- ' Concatenate a list of attachment files in a string.
- Dim sAttach As String = "C:\images\image1.jpg,C:\images\image2.jpg,C:\images\image3.jpg"
-
- ' Build an IList of mail attachments using the files named in the string.
- Dim delim As Char = ","
- Dim sSubstr As String
- For Each sSubstr in sAttach.Split(delim)
- Dim myAttachment As MailAttachment = New MailAttachment(sSubstr)
- myMail.Attachments.Add(myAttachment)
- Next
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/VB/systemwebmailmailmessagefrom.vb b/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/VB/systemwebmailmailmessagefrom.vb
deleted file mode 100644
index 451d7056993..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageFrom/VB/systemwebmailmailmessagefrom.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.From = "john@contoso.com"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageTo/VB/systemwebmailmailmessageto.vb b/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageTo/VB/systemwebmailmailmessageto.vb
deleted file mode 100644
index ca6ce833dff..00000000000
--- a/snippets/visualbasic/VS_Snippets_WebNet/SystemWebMailMailMessageTo/VB/systemwebmailmailmessageto.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Imports System.Web.Mail
-
-Namespace MyNameSpace
-Module Module1
- Public Sub Main()
- '
- Dim MyMessage As MailMessage = New MailMessage()
- MyMessage.To = "john@contoso.com"
- '
- End Sub
-End Module
-End Namespace
\ No newline at end of file
diff --git a/xml/FrameworksIndex/net-10.0-pp.xml b/xml/FrameworksIndex/net-10.0-pp.xml
index 53fdb73798b..3816615e16e 100644
--- a/xml/FrameworksIndex/net-10.0-pp.xml
+++ b/xml/FrameworksIndex/net-10.0-pp.xml
@@ -5,25 +5,25 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
@@ -36,21 +36,21 @@
-
+
-
+
-
+
-
-
-
-
+
+
+
+
@@ -59,11 +59,11 @@
-
+
-
+
-
+
@@ -75,17 +75,17 @@
-
+
-
+
-
-
-
-
+
+
+
+
@@ -93,6 +93,8 @@
+
+
@@ -238,6 +240,7 @@
+
@@ -840,6 +843,7 @@
+
@@ -3904,7 +3908,7 @@
-
+
@@ -6523,7 +6527,9 @@
+
+
@@ -9313,29 +9319,21 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
+
+
+
@@ -9351,228 +9349,158 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
@@ -9587,49 +9515,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
@@ -9643,212 +9539,265 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -9868,10 +9817,8 @@
-
-
diff --git a/xml/FrameworksIndex/net-6.0-pp.xml b/xml/FrameworksIndex/net-6.0-pp.xml
index bf17510c82a..394427a03fb 100644
--- a/xml/FrameworksIndex/net-6.0-pp.xml
+++ b/xml/FrameworksIndex/net-6.0-pp.xml
@@ -2,7 +2,6 @@
-
@@ -230,568 +229,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xml/FrameworksIndex/net-7.0-pp.xml b/xml/FrameworksIndex/net-7.0-pp.xml
index 7596d2af61d..c97443f9604 100644
--- a/xml/FrameworksIndex/net-7.0-pp.xml
+++ b/xml/FrameworksIndex/net-7.0-pp.xml
@@ -2,7 +2,6 @@
-
@@ -229,568 +228,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xml/FrameworksIndex/net-8.0-pp.xml b/xml/FrameworksIndex/net-8.0-pp.xml
index 32350f62a73..e9a4f5e0ffa 100644
--- a/xml/FrameworksIndex/net-8.0-pp.xml
+++ b/xml/FrameworksIndex/net-8.0-pp.xml
@@ -5,23 +5,23 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
@@ -33,18 +33,18 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -52,11 +52,11 @@
-
+
-
+
-
+
@@ -65,22 +65,24 @@
-
+
-
+
-
-
-
-
+
+
+
+
+
+
@@ -226,6 +228,7 @@
+
@@ -828,6 +831,7 @@
+
@@ -3660,7 +3664,7 @@
-
+
@@ -6066,7 +6070,9 @@
+
+
@@ -8832,29 +8838,21 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
+
+
+
@@ -8870,228 +8868,158 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
@@ -9106,49 +9034,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
@@ -9162,212 +9058,265 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -9387,10 +9336,8 @@
-
-
diff --git a/xml/FrameworksIndex/net-9.0-pp.xml b/xml/FrameworksIndex/net-9.0-pp.xml
index 96e5defc722..0e275441187 100644
--- a/xml/FrameworksIndex/net-9.0-pp.xml
+++ b/xml/FrameworksIndex/net-9.0-pp.xml
@@ -5,23 +5,23 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
@@ -33,18 +33,18 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -52,11 +52,11 @@
-
+
-
+
-
+
@@ -65,22 +65,24 @@
-
+
-
+
-
-
-
-
+
+
+
+
+
+
@@ -226,6 +228,7 @@
+
@@ -828,6 +831,7 @@
+
@@ -3690,7 +3694,7 @@
-
+
@@ -6102,7 +6106,9 @@
+
+
@@ -8854,29 +8860,21 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
+
+
+
@@ -8892,228 +8890,158 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
@@ -9128,49 +9056,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
@@ -9184,212 +9080,265 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -9409,10 +9358,8 @@
-
-
diff --git a/xml/FrameworksIndex/netframework-4.6.2-pp.xml b/xml/FrameworksIndex/netframework-4.6.2-pp.xml
index a440792e07e..b699f73e09b 100644
--- a/xml/FrameworksIndex/netframework-4.6.2-pp.xml
+++ b/xml/FrameworksIndex/netframework-4.6.2-pp.xml
@@ -7,24 +7,24 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -37,20 +37,20 @@
-
+
-
+
-
+
-
-
-
-
+
+
+
+
@@ -58,11 +58,11 @@
-
+
-
+
-
+
@@ -74,17 +74,17 @@
-
+
-
+
-
-
-
-
+
+
+
+
@@ -218,6 +218,7 @@
+
@@ -820,6 +821,7 @@
+
@@ -3755,7 +3757,7 @@
-
+
@@ -6335,7 +6337,9 @@
+
+
diff --git a/xml/FrameworksIndex/netstandard-2.0-pp.xml b/xml/FrameworksIndex/netstandard-2.0-pp.xml
index f44f9be4038..6aa8505203b 100644
--- a/xml/FrameworksIndex/netstandard-2.0-pp.xml
+++ b/xml/FrameworksIndex/netstandard-2.0-pp.xml
@@ -7,23 +7,23 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -239,6 +239,7 @@
+
@@ -841,6 +842,7 @@
+
@@ -5496,7 +5498,9 @@
+
+
@@ -8866,29 +8870,21 @@
-
-
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
+
+
+
@@ -8904,228 +8900,159 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
-
-
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
@@ -9140,49 +9067,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
@@ -9196,15 +9091,15 @@
-
-
+
+
+
-
@@ -9218,12 +9113,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -9239,68 +9134,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -9313,31 +9169,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9381,8 +9228,13 @@
+
+
+
+
+
@@ -9471,7 +9323,7 @@
-
+
@@ -9480,14 +9332,13 @@
-
+
-
-
+
@@ -9519,88 +9370,56 @@
-
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -9620,10 +9439,8 @@
-
-
@@ -9750,10 +9567,6 @@
-
-
-
-
diff --git a/xml/FrameworksIndex/netstandard-2.1-pp.xml b/xml/FrameworksIndex/netstandard-2.1-pp.xml
index 3e02cc4871c..52493949129 100644
--- a/xml/FrameworksIndex/netstandard-2.1-pp.xml
+++ b/xml/FrameworksIndex/netstandard-2.1-pp.xml
@@ -6,7 +6,7 @@
-
+
@@ -1119,22 +1119,18 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CoherenceEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CoherenceEvaluator.xml
index bc5432bd888..28decc205a8 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CoherenceEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CoherenceEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -70,7 +71,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -88,7 +89,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -114,7 +115,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -171,7 +172,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluator.xml
index 72fee8a2c33..9650ab883ac 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -63,7 +64,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -81,7 +82,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -107,7 +108,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -164,7 +165,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluatorContext.xml
index f9f342ad767..1e070f75bba 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/CompletenessEvaluatorContext.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -45,7 +46,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -75,7 +76,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -102,7 +103,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluator.xml
index 1de86ccc93f..9d176a75ef0 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -65,7 +66,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -83,7 +84,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -109,7 +110,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -166,7 +167,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluatorContext.xml
index 0883b04350a..11a92aed567 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/EquivalenceEvaluatorContext.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -45,7 +46,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -74,7 +75,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -100,7 +101,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/FluencyEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/FluencyEvaluator.xml
index b1ef95ab319..d4f9f626f97 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/FluencyEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/FluencyEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -64,7 +65,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -84,7 +85,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -141,7 +142,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -163,7 +164,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluator.xml
index 2f4d64a0573..a146d20df12 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -64,7 +65,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -84,7 +85,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -141,7 +142,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -163,7 +164,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluatorContext.xml
index e5b8c2e1c16..9c3da9438f3 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/GroundednessEvaluatorContext.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -45,7 +46,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -74,7 +75,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -100,7 +101,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceEvaluator.xml
index dcad59d2f47..462b77c4ce1 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -66,7 +67,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -86,7 +87,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -143,7 +144,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -165,7 +166,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceTruthAndCompletenessEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceTruthAndCompletenessEvaluator.xml
index dbd8e661625..95d496b00b0 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceTruthAndCompletenessEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RelevanceTruthAndCompletenessEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -72,7 +73,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -90,7 +91,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -116,7 +117,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -173,7 +174,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -195,7 +196,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -219,7 +220,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluator.xml
index cf6693314da..431323b9d74 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -70,7 +71,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -90,7 +91,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -147,7 +148,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -169,7 +170,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluatorContext.xml
index fea4117bbf5..c12d4338f38 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Quality/RetrievalEvaluatorContext.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Quality
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -50,7 +51,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -75,7 +76,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
@@ -107,7 +108,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<System.String>
@@ -130,7 +131,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Quality
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Html/HtmlReportWriter.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Html/HtmlReportWriter.xml
index ae207f37abe..0a916b5bc99 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Html/HtmlReportWriter.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Html/HtmlReportWriter.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -48,7 +49,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -77,7 +78,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Json/JsonReportWriter.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Json/JsonReportWriter.xml
index da4a311d5ae..f8f52986953 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Json/JsonReportWriter.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Formats.Json/JsonReportWriter.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -48,7 +49,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -77,7 +78,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageReportingConfiguration.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageReportingConfiguration.xml
index 1123f443987..1d934dd7b47 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageReportingConfiguration.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageReportingConfiguration.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -32,7 +33,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Reporting.ReportingConfiguration
@@ -123,7 +124,13 @@
A that persists s to Azure Storage
and also uses Azure Storage to cache AI responses.
- To be added.
+
+ Note that when is set to , the cache keys used
+ for the cached responses are not guaranteed to be stable across releases of the library. In other words, when
+ you update your code to reference a newer version of the library, it is possible that old cached responses
+ (persisted to the cache using older versions of the library) will no longer be used - instead new responses
+ will be fetched from the LLM and added to the cache for use in subsequent executions.
+
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResponseCacheProvider.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResponseCacheProvider.xml
index c45541cdc82..df5d44fbae6 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResponseCacheProvider.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResponseCacheProvider.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -50,7 +51,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -84,7 +85,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -112,7 +113,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.Caching.Distributed.IDistributedCache>
@@ -150,7 +151,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResultStore.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResultStore.xml
index f377134305b..fa5f9362362 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResultStore.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/AzureStorageResultStore.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -47,7 +48,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -76,7 +77,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -110,7 +111,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -155,7 +156,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -198,7 +199,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -241,7 +242,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
@@ -294,7 +295,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting.Azure
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedReportingConfiguration.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedReportingConfiguration.xml
index 474fd2c3679..6892c375294 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedReportingConfiguration.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedReportingConfiguration.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -32,7 +33,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Reporting.ReportingConfiguration
@@ -123,7 +124,13 @@
A that persists s to disk and also uses the
disk to cache AI responses.
- To be added.
+
+ Note that when is set to , the cache keys used
+ for the cached responses are not guaranteed to be stable across releases of the library. In other words, when
+ you update your code to reference a newer version of the library, it is possible that old cached responses
+ (persisted to the cache using older versions of the library) will no longer be used - instead new responses
+ will be fetched from the LLM and added to the cache for use in subsequent executions.
+
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResponseCacheProvider.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResponseCacheProvider.xml
index 7717473fe2f..81c2cbf4d06 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResponseCacheProvider.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResponseCacheProvider.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -50,7 +51,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -84,7 +85,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -112,7 +113,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.Caching.Distributed.IDistributedCache>
@@ -150,7 +151,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResultStore.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResultStore.xml
index 74c9a99e863..ac8e6042eca 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResultStore.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting.Storage/DiskBasedResultStore.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -42,7 +43,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -69,7 +70,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -103,7 +104,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -152,7 +153,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -199,7 +200,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -246,7 +247,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -303,7 +304,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetails.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetails.xml
index 47b2f327125..3940456473b 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetails.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetails.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -38,7 +39,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -70,7 +71,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -95,7 +96,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -126,7 +127,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IList<Microsoft.Extensions.AI.Evaluation.Reporting.ChatTurnDetails>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetailsExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetailsExtensions.xml
index a0fba09dd96..94bed651451 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetailsExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatDetailsExtensions.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -37,7 +38,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -77,7 +78,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Void
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatTurnDetails.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatTurnDetails.xml
index 32bab29c91d..56e40a7ba5c 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatTurnDetails.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ChatTurnDetails.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -58,7 +59,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -106,7 +107,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Nullable<System.Boolean>
@@ -131,7 +132,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -156,7 +157,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.TimeSpan
@@ -180,7 +181,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -205,7 +206,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.UsageDetails
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/Defaults.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/Defaults.xml
index 351eaa13325..62c47bd8932 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/Defaults.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/Defaults.xml
@@ -10,6 +10,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -38,7 +39,7 @@
Field
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -61,7 +62,7 @@
Field
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -85,7 +86,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.TimeSpan
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationReportWriter.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationReportWriter.xml
index 8af2c3556c8..83a105ad36d 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationReportWriter.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationReportWriter.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
@@ -30,7 +31,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResponseCacheProvider.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResponseCacheProvider.xml
index 793dc10b2e0..452d8d5dfff 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResponseCacheProvider.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResponseCacheProvider.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
9.4.0.0
9.5.0.0
+ 9.6.0.0
@@ -36,7 +37,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -62,7 +63,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.Caching.Distributed.IDistributedCache>
@@ -104,7 +105,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResultStore.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResultStore.xml
index 9d2e4d29452..a0b973d5753 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResultStore.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/IEvaluationResultStore.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
9.4.0.0
9.5.0.0
+ 9.6.0.0
@@ -27,7 +28,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -75,7 +76,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IAsyncEnumerable<System.String>
@@ -109,7 +110,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IAsyncEnumerable<System.String>
@@ -141,7 +142,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IAsyncEnumerable<System.String>
@@ -173,7 +174,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRunResult>
@@ -227,7 +228,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ReportingConfiguration.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ReportingConfiguration.xml
index 722bcb5aa9a..eba051cb5cc 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ReportingConfiguration.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ReportingConfiguration.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -44,7 +45,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -142,7 +143,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<System.String>
@@ -186,7 +187,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -215,7 +216,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.Reporting.ScenarioRun>
@@ -284,7 +285,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -318,7 +319,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.Evaluation.IEvaluator>
@@ -341,7 +342,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -366,7 +367,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -395,7 +396,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Reporting.IEvaluationResultStore
@@ -419,7 +420,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRun.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRun.xml
index 181d3828296..f703d5915fb 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRun.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRun.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -50,7 +51,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -84,7 +85,7 @@
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask
@@ -108,7 +109,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -163,7 +164,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -209,7 +210,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -242,7 +243,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunExtensions.xml
index a1500e7e163..faaab2c7bd8 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunExtensions.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -38,7 +39,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -89,7 +90,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -140,7 +141,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -191,7 +192,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -247,7 +248,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -303,7 +304,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResult.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResult.xml
index c4935e7b907..d8f4fb15562 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResult.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResult.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -68,7 +69,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -131,7 +132,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -212,7 +213,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
@@ -246,7 +247,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.DateTime
@@ -269,7 +270,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationResult
@@ -297,7 +298,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -320,7 +321,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Nullable<System.Int32>
@@ -343,7 +344,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -366,7 +367,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage>
@@ -390,7 +391,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.ChatResponse
@@ -413,7 +414,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -436,7 +437,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResultExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResultExtensions.xml
index e5a3ba65ec7..e67e31ff9c2 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResultExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Reporting/ScenarioRunResultExtensions.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -32,7 +33,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Reporting
- 9.5.0.0
+ 9.6.0.0
System.Boolean
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/CodeVulnerabilityEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/CodeVulnerabilityEvaluator.xml
index b61691a374f..62f5a33d186 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/CodeVulnerabilityEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/CodeVulnerabilityEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -60,7 +61,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -99,7 +100,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -122,7 +123,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentHarmEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentHarmEvaluator.xml
index 389c2bd32d2..b990587b0d4 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentHarmEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentHarmEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -60,7 +61,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -106,7 +107,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyEvaluator.xml
index 7d9ceea4db5..1fc5b2c8576 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -57,7 +58,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -93,7 +94,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -146,7 +147,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -218,7 +219,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
@@ -240,7 +241,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.Evaluation.EvaluationContext>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfiguration.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfiguration.xml
index 092630daa41..8494c5a0f61 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfiguration.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfiguration.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -59,7 +60,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -116,7 +117,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
Azure.Core.TokenCredential
@@ -139,7 +140,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -172,7 +173,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -195,7 +196,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -218,7 +219,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -241,7 +242,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Int32
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfigurationExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfigurationExtensions.xml
index e835a77c86b..05266cf2455 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfigurationExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyServiceConfigurationExtensions.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -36,7 +37,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.ChatConfiguration
@@ -87,7 +88,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.ChatConfiguration
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluator.xml
index 7b3f5afe58d..d8cf83ff9da 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -59,7 +60,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -96,7 +97,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -150,7 +151,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.Evaluation.EvaluationContext>
@@ -189,7 +190,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluatorContext.xml
index 335a2f80f3a..8f7987899dc 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/GroundednessProEvaluatorContext.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -44,7 +45,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -73,7 +74,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -99,7 +100,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/HateAndUnfairnessEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/HateAndUnfairnessEvaluator.xml
index ef418fd4771..44e9e43d634 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/HateAndUnfairnessEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/HateAndUnfairnessEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentHarmEvaluator
@@ -52,7 +53,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -83,7 +84,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/IndirectAttackEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/IndirectAttackEvaluator.xml
index 24dcf7d6b0b..dda7fb928f4 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/IndirectAttackEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/IndirectAttackEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -74,7 +75,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -127,7 +128,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ProtectedMaterialEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ProtectedMaterialEvaluator.xml
index a94e7e76161..0923651e817 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ProtectedMaterialEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ProtectedMaterialEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -54,7 +55,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -87,7 +88,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -141,7 +142,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -165,7 +166,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -189,7 +190,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -213,7 +214,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/SelfHarmEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/SelfHarmEvaluator.xml
index 2c1228076ac..83c44902b69 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/SelfHarmEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/SelfHarmEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentHarmEvaluator
@@ -52,7 +53,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -83,7 +84,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/SexualEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/SexualEvaluator.xml
index dddcfbf5d3e..d31dd1e0a1c 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/SexualEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/SexualEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentHarmEvaluator
@@ -52,7 +53,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -83,7 +84,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluator.xml
index f6442a07124..b2fd40dd25c 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyEvaluator
@@ -62,7 +63,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -102,7 +103,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -156,7 +157,7 @@
Method
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.Evaluation.EvaluationContext>
@@ -195,7 +196,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluatorContext.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluatorContext.xml
index c05dd090bb9..b48b643f8cd 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluatorContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/UngroundedAttributesEvaluatorContext.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationContext
@@ -45,7 +46,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -75,7 +76,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -102,7 +103,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ViolenceEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ViolenceEvaluator.xml
index 9a813db3afb..706c16e4d23 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation.Safety/ViolenceEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation.Safety/ViolenceEvaluator.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation.Safety
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.Safety.ContentHarmEvaluator
@@ -52,7 +53,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
@@ -83,7 +84,7 @@
Property
Microsoft.Extensions.AI.Evaluation.Safety
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/BooleanMetric.xml b/xml/Microsoft.Extensions.AI.Evaluation/BooleanMetric.xml
index 04a61f9654b..63522545ffb 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/BooleanMetric.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/BooleanMetric.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationMetric<System.Nullable<System.Boolean>>
@@ -42,7 +43,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/ChatConfiguration.xml b/xml/Microsoft.Extensions.AI.Evaluation/ChatConfiguration.xml
index bad81a55e32..dea2cbd22bb 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/ChatConfiguration.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/ChatConfiguration.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -44,7 +45,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -67,7 +68,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.IChatClient
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/ChatMessageExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation/ChatMessageExtensions.xml
index 37593c08d2a..6be501579c6 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/ChatMessageExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/ChatMessageExtensions.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -37,7 +38,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -78,7 +79,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -120,7 +121,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Boolean
@@ -171,7 +172,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Boolean
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/ChatResponseExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation/ChatResponseExtensions.xml
index c2ef706efda..aa9c7c76c6d 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/ChatResponseExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/ChatResponseExtensions.xml
@@ -9,6 +9,7 @@
Microsoft.Extensions.AI.Evaluation
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -31,7 +32,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/CompositeEvaluator.xml b/xml/Microsoft.Extensions.AI.Evaluation/CompositeEvaluator.xml
index ad0935210a7..47a53db104b 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/CompositeEvaluator.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/CompositeEvaluator.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -44,7 +45,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -75,7 +76,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -101,7 +102,7 @@
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
@@ -179,7 +180,7 @@
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IReadOnlyCollection<System.String>
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationContext.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationContext.xml
index 049a236edb0..b3a9cd08ca8 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationContext.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationContext.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -71,7 +72,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -105,7 +106,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -132,7 +133,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -159,7 +160,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent>
@@ -217,7 +218,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnostic.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnostic.xml
index 3280baf2126..60109d4c1dc 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnostic.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnostic.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -47,7 +48,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -78,7 +79,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnostic
@@ -109,7 +110,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnostic
@@ -140,7 +141,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -163,7 +164,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnosticSeverity
@@ -187,7 +188,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
@@ -209,7 +210,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnostic
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnosticSeverity.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnosticSeverity.xml
index 4134b8556f4..850cf369c5b 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnosticSeverity.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationDiagnosticSeverity.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Enum
@@ -32,7 +33,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnosticSeverity
@@ -54,7 +55,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnosticSeverity
@@ -76,7 +77,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationDiagnosticSeverity
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric.xml
index a6cc800de0b..2055dd138d9 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -59,7 +60,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -94,7 +95,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -124,7 +125,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -154,7 +155,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationMetricInterpretation
@@ -179,7 +180,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -209,7 +210,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -238,7 +239,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricExtensions.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricExtensions.xml
index 3380c9882ac..6b0ccf26842 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricExtensions.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricExtensions.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -39,7 +40,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -75,7 +76,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -103,7 +104,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -137,7 +138,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -173,7 +174,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -202,7 +203,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -231,7 +232,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Void
@@ -261,7 +262,7 @@
Method
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Boolean
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricInterpretation.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricInterpretation.xml
index 2f33fe92b20..7fc0d091395 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricInterpretation.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetricInterpretation.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -50,7 +51,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -86,7 +87,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.Boolean
@@ -113,7 +114,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -137,7 +138,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
System.String
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric`1.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric`1.xml
index ecf96aa1fbf..8ded3d84ec4 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric`1.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationMetric`1.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
@@ -45,7 +46,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -82,7 +83,7 @@
Property
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
T
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationRating.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationRating.xml
index 43267f6f5e4..880d8d5d570 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationRating.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationRating.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Enum
@@ -33,7 +34,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -55,7 +56,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -77,7 +78,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -99,7 +100,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -121,7 +122,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -143,7 +144,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
@@ -165,7 +166,7 @@
Field
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
Microsoft.Extensions.AI.Evaluation.EvaluationRating
diff --git a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationResult.xml b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationResult.xml
index 8a79a1a4891..94d60dd425d 100644
--- a/xml/Microsoft.Extensions.AI.Evaluation/EvaluationResult.xml
+++ b/xml/Microsoft.Extensions.AI.Evaluation/EvaluationResult.xml
@@ -11,6 +11,7 @@
9.3.0.0
9.4.0.0
9.5.0.0
+ 9.6.0.0
System.Object
@@ -42,7 +43,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -74,7 +75,7 @@
Constructor
Microsoft.Extensions.AI.Evaluation
- 9.5.0.0
+ 9.6.0.0
@@ -111,7 +112,7 @@
Constructor