Skip to content

Commit

Permalink
Add user-agent to requests
Browse files Browse the repository at this point in the history
  • Loading branch information
artemlos committed Nov 24, 2022
1 parent 7db4025 commit 839d327
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion Cryptolens.Licensing/Core/HelperMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ public static T SendRequestToWebAPI3<T>(RequestModel inputParameters,
#if !KeepAliveDisabled
using (WebClient client = new WebClient())
{
NameValueCollection reqparm = new NameValueCollection();
try
{
var asm = AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().Location);
client.Headers.Add(HttpRequestHeader.UserAgent, $"{asm.Name}/{asm.Version}");
}
catch (Exception ex) { }

NameValueCollection reqparm = new NameValueCollection();

foreach (var input in inputParams)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Cryptolens AB</Company>
<Authors>Cryptolens AB</Authors>
<Version>4.0.41</Version>
<AssemblyVersion>4.0.41.1</AssemblyVersion>
<FileVersion>4.0.41.1</FileVersion>
<Version>4.0.42</Version>
<AssemblyVersion>4.0.42.1</AssemblyVersion>
<FileVersion>4.0.42.1</FileVersion>
<Description>An API documentation can be found at https://help.cryptolens.io/api/dotnet/.

This is a client API that serves as an interface to Cryptolens Web API (app.cryptolens.io/docs/api/).
Expand Down
6 changes: 3 additions & 3 deletions Cryptolens.Licensing/Cryptolens.Licensing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Cryptolens AB</Company>
<Authors>Cryptolens AB</Authors>
<Version>4.0.41</Version>
<AssemblyVersion>4.0.41.1</AssemblyVersion>
<FileVersion>4.0.41.1</FileVersion>
<Version>4.0.42</Version>
<AssemblyVersion>4.0.42.1</AssemblyVersion>
<FileVersion>4.0.42.1</FileVersion>
<Description>An API documentation can be found at https://help.cryptolens.io/api/dotnet/.

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

0 comments on commit 839d327

Please sign in to comment.