Identifying clients on a Server-side blazor app

Posted 107 days ago by clemenslinders


I would like to know if there is way of identifying clients on a Server-side blazor app.


The problem:

We are using aprox 50 handhelds based on Windows CE and we are trying to convert the app to Blazor which will be used on Android handhelds.


It is essential that each handheld identifies itself. In Windows CE, we have a config file and in this config file there is a line like: Handheld: 01


I cannot believe that we are the only company that would like to identify the clients in a manner like this.

So there should be a solution for this.


The current software for our handhelds is split in two parts.

One web service processes all data from all the handhelds (that is why the client needs to be identified)

Each handheld communicates with the web service and basically only displays data and sends out a selection.


We would like to create a server side blazor app that communicates with the existing web service.

We have already made quite some progress, but we need this identification.


Of course if it is not possible we could let the user select the handheld at startup, but that is asking for problems.


Kind regards,

Clemens Linders

  • 0

    It seems like the closest thing to what you're describing would be placing the setting (device name) in the appsettings.json file, then retrieving the value by injecting IConfiguration (Microsoft.Extensions.Configuration.IConfiguration) into your blazor component.

    @page "/SomePage"
    @inject IConfiguration config
    @code {
        string deviceName;
        protected override void OnInitialized()
            deviceName = config.GetSection("DeviceName").Value;

    And your appsettings.json / appsettings.Development.json would include something like this:

      "ConnectionStrings": {
      "Logging": {
      "DeviceName": "01"

    Your component could then use the specific device name when communicating with your service.

    Posted 107 days ago by selliott
  • 0

    Hi Selliot,


    Thanks for your reply, sorry for my delayed reply (I've been away).


    This looks like it could work, but if I find info about appsettings.json that info says that this file should be located in the startup folder.

    And if you are using a client side application , than that will be fine.


    However I am using a serverside application.


    Is there a location on an Android machine where I can place this appsettings.json file (is that also the name, or should it have a different name)?


    Or does this only work for Blazor client side??




    Kind regards,




    Clemens Linders

    Posted 96 days ago by clemenslinders
  • 0

    You are correct, it's typically not a good idea to put an appsettings.json file in a client. You definitely don't want to put secrets/keys in the client anywhere, since it's possible to decompile and read the code. At a glance, I wasn't sure what your particular need was and I just assumed that's what you were asking for anyway. 

    If you're just having them access through a web browser, then maybe all you really need to do is create user accounts (handheld01, handheld02, etc...) and have them login, then authenticate and process the data in the API based on that. Another benefit to this route is that it would be easy to replace a broken device.

    If you're installing an app (built in something like MAUI or maybe even the experimental Blazor Mobile Bindings in Xamarin), it may be able to access the device name, since a native app gets more access to the device. Even if you can access the device name, it's still a good idea to require authentication before trusting any data being provided to the API.

    Posted 96 days ago by selliott Edited 96 days ago
  • 0

    Hi Selliot,

    We don't need to pass connectionstrings or anything secret.

    The workaround I found is using a parameter when accessing the Blazor server app.

    Starting the Blazor server side app is a matter of clicking on an icon, and in this icon it calls the corresponding http address and it passes a parameter for the handheld number.

    All we need to do now is (one time) change this parameter per handheld.


    I did wonder if it was possible to do this in a manner as you described, but than I would need to know where to place this json file and what name to give it.


    Kind regards,



    Clemens Linders 

    Posted 95 days ago by clemenslinders
Someone is typing...

Post a Reply

You must be logged in to add a new post.
Number of online users: 1
An error has occurred. This application may no longer respond until reloaded. Reload 🗙