Skip to content

Commit 839d327

Browse files
committed
Add user-agent to requests
1 parent 7db4025 commit 839d327

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Cryptolens.Licensing/Core/HelperMethods.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ public static T SendRequestToWebAPI3<T>(RequestModel inputParameters,
6363
#if !KeepAliveDisabled
6464
using (WebClient client = new WebClient())
6565
{
66-
NameValueCollection reqparm = new NameValueCollection();
66+
try
67+
{
68+
var asm = AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().Location);
69+
client.Headers.Add(HttpRequestHeader.UserAgent, $"{asm.Name}/{asm.Version}");
70+
}
71+
catch (Exception ex) { }
72+
73+
NameValueCollection reqparm = new NameValueCollection();
6774

6875
foreach (var input in inputParams)
6976
{

Cryptolens.Licensing/Cryptolens.Licensing.CrossPlatform.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
<Company>Cryptolens AB</Company>
88
<Authors>Cryptolens AB</Authors>
9-
<Version>4.0.41</Version>
10-
<AssemblyVersion>4.0.41.1</AssemblyVersion>
11-
<FileVersion>4.0.41.1</FileVersion>
9+
<Version>4.0.42</Version>
10+
<AssemblyVersion>4.0.42.1</AssemblyVersion>
11+
<FileVersion>4.0.42.1</FileVersion>
1212
<Description>An API documentation can be found at https://help.cryptolens.io/api/dotnet/.
1313

1414
This is a client API that serves as an interface to Cryptolens Web API (app.cryptolens.io/docs/api/).

Cryptolens.Licensing/Cryptolens.Licensing.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
<Company>Cryptolens AB</Company>
88
<Authors>Cryptolens AB</Authors>
9-
<Version>4.0.41</Version>
10-
<AssemblyVersion>4.0.41.1</AssemblyVersion>
11-
<FileVersion>4.0.41.1</FileVersion>
9+
<Version>4.0.42</Version>
10+
<AssemblyVersion>4.0.42.1</AssemblyVersion>
11+
<FileVersion>4.0.42.1</FileVersion>
1212
<Description>An API documentation can be found at https://help.cryptolens.io/api/dotnet/.
1313

1414
This is a client API that serves as an interface to Cryptolens Web API (app.cryptolens.io/docs/api/).

0 commit comments

Comments
 (0)