JP.MVC.Helpers
0.9.6-alpha
dotnet add package JP.MVC.Helpers --version 0.9.6-alpha
NuGet\Install-Package JP.MVC.Helpers -Version 0.9.6-alpha
<PackageReference Include="JP.MVC.Helpers" Version="0.9.6-alpha" />
paket add JP.MVC.Helpers --version 0.9.6-alpha
#r "nuget: JP.MVC.Helpers, 0.9.6-alpha"
// Install JP.MVC.Helpers as a Cake Addin #addin nuget:?package=JP.MVC.Helpers&version=0.9.6-alpha&prerelease // Install JP.MVC.Helpers as a Cake Tool #tool nuget:?package=JP.MVC.Helpers&version=0.9.6-alpha&prerelease
JP.MVC.Helpers README
The following readme will explain the latest updates to this library and provide a brief usage guide for CookieManager and CACHelper.
Latest updates in 0.9.6.0-alpha
- Removed CookieHelper class This has been phased out of this version. If you still need it, it is available in 0.9.5.0. CookieManager is the new cookie class to use.
- Changes to CookieManager class This class has been updated to better handle updating of an existing cookie. Should no longer find an issue with updating cookies.
- Renamed Library Renamed the library to "JP.MVC.Helpers" to match name of NuGet package.
To update your project, replace all instances of the following:
using WDS_Helper;
to
using JP.MVC.Helpers;
----------------------------------
Usage Examples
To use any of the helper classes, you'll need to reference the library with:
using JP.MVC.Helpers;
CookieManager
The following examples use "localhost" as the domain for testing. Replace this value in the CookieStore call to use whatever domain you wish.
Add Cookie with 2 key/value pairs (localhost):
Dictionary<string, string> values = new Dictionary<string, string>();
values.Add("c1key", "cookie 1 value");
values.Add("c2key", "cookie 2 value");
CookieManager.CookieStore("SiteCookie", "localhost", values, DateTime.Now.AddDays(1), false, false);
----------------------------------
Retrieve a Cookie Value (localhost)
var temp = CookieManager.GetFromCookieStore("SiteCookie", "c1key");
----------------------------------
Check if Cookie Value Exists (localhost)
if(CookieManager.CookieExist("SiteCookie", "c1key"))
----------------------------------
Remove Cookie Value (localhost)
CookieManager.RemoveCookie("SiteCookie", "c1key", "localhost");
----------------------------------
CACHelper
Initialize CACHelper
public static CACHelper cachelper = new CACHelper();
cachelper.isLocal = true;
cachelper.mockSubjectLine = "C = US, O = Developer, OU = Dev, OU = PKI, OU = USA, CN = Developer.Test.J.1234567890"
or
public static CACHelper cachelper = new CACHelper() { isLocal = true, mockSubjectLine = "C = US, O = Developer, OU = Dev, OU = PKI, OU = USA, CN = Developer.Test.J.1234567890"};
----------------------------------
CACParameter
CACHelper has an enum property called CACParameter that allows you to obtain data from the Common Access Card/Client Certificate
public enum CACParameter
{
/// <summary>
/// Entire "Subject" line from currently selected Common Access Card/Client Certificate.
/// </summary>
AllData,
/// <summary>
/// Gets full name from currently selected Common Access Card/Client Certificate.
/// </summary>
FullName,
/// <summary>
/// Gets first name from currently selected Common Access Card/Client Certificate.
/// </summary>
FirstName,
/// <summary>
/// Gets last name from currently selected Common Access Card/Client Certificate.
/// </summary>
LastName,
/// <summary>
/// Gets middle initial from currently selected Common Access Card/Client Certificate.
/// </summary>
MiddleInitial,
/// <summary>
/// Concatenates first and last name from currently selected Common Access Card/Client Certificate.
/// </summary>
FirstAndLast,
/// <summary>
/// Gets CAC ID (EDIPI) from currently selected Common Access Card/Client Certificate.
/// </summary>
CACIdentifier
}
----------------------------------
Retrieve CAC Parameter
cachelper.GetCACInfo(CACHelper.CACParameter.CACIdentifier)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
-
.NETFramework 4.6.1
- System.DirectoryServices (>= 5.0.0)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7.2
- System.DirectoryServices (>= 5.0.0)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.8
- System.DirectoryServices (>= 5.0.0)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.9.6-alpha | 217 | 10/18/2021 |
0.9.5-alpha | 158 | 10/14/2021 |
0.9.4-alpha | 158 | 10/14/2021 |