title: How to keep case-sensitive in Restful response?
body: <p>How to keep case-sensitive in Restful response?</p>
  <p>My friend complain about case-sensitive in RESTful response</p>
  <p><a href="https://i.stack.imgur.com/smZ4Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/smZ4Y.png" alt="enter image description here" /></a></p>
  <p>file <code>*.csproj</code></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
      &lt;UserSecretsId&gt;4942e08e-0489-4b66-ab36-7c1376ecb8a8&lt;/UserSecretsId&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;AWSSDK&quot; Version=&quot;2.3.55.2&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Authentication.JwtBearer&quot; Version=&quot;5.0.0-preview.8.20414.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Cors&quot; Version=&quot;2.2.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Identity&quot; Version=&quot;2.2.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Identity.EntityFrameworkCore&quot; Version=&quot;5.0.0-preview.8.20414.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Identity.UI&quot; Version=&quot;5.0.0-preview.8.20414.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore&quot; Version=&quot;5.0.0-preview.8.20407.4&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.SqlServer&quot; Version=&quot;5.0.0-preview.8.20407.4&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Tools&quot; Version=&quot;5.0.0-preview.8.20407.4&quot;&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.Extensions.Identity.Core&quot; Version=&quot;5.0.0-preview.8.20414.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Web.CodeGeneration.Design&quot; Version=&quot;5.0.0-preview.8.20419.1&quot; /&gt;
      &lt;PackageReference Include=&quot;MimeKit&quot; Version=&quot;2.9.1&quot; /&gt;
      &lt;PackageReference Include=&quot;NAudio&quot; Version=&quot;1.10.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Newtonsoft.Json&quot; Version=&quot;12.0.3&quot; /&gt;
      &lt;PackageReference Include=&quot;NUnit&quot; Version=&quot;3.12.0&quot; /&gt;
      &lt;PackageReference Include=&quot;RestSharp&quot; Version=&quot;106.11.5-alpha.0.18&quot; /&gt;
      &lt;PackageReference Include=&quot;SendGrid&quot; Version=&quot;9.21.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Serilog&quot; Version=&quot;2.10.0-dev-01240&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore&quot; Version=&quot;5.5.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore.Annotations&quot; Version=&quot;5.5.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore.Swagger&quot; Version=&quot;5.5.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore.SwaggerGen&quot; Version=&quot;5.5.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore.SwaggerUI&quot; Version=&quot;5.5.1&quot; /&gt;
  
      &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Azure.Containers.Tools.Targets&quot; Version=&quot;1.10.9&quot; /&gt;
  
      &lt;PackageReference Include=&quot;System.ServiceModel.Syndication&quot; Version=&quot;5.0.0-preview.8.20407.11&quot; /&gt;
      &lt;PackageReference Include=&quot;System.Text.Encoding.CodePages&quot; Version=&quot;5.0.0-preview.8.20407.11&quot; /&gt;
      &lt;PackageReference Include=&quot;Twilio&quot; Version=&quot;5.46.2&quot; /&gt;
      &lt;PackageReference Include=&quot;Twilio.AspNet.Core&quot; Version=&quot;5.33.1&quot; /&gt;
    &lt;/ItemGroup&gt;
  
  
  &lt;/Project&gt;
  
  </code></pre>
  <pre class="lang-cs prettyprint-override"><code>        /// &lt;summary&gt;
          /// GET: http://localhost:5002/TrustedPerson/5
          /// &lt;/summary&gt;
          /// &lt;param name=&quot;id&quot;&gt;&lt;/param&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          [HttpGet(&quot;{id}&quot;)]
          public async Task&lt;ActionResult&lt;TrustedPerson&gt;&gt; ViewTrustedPerson(int id)
          {
              var item = await _db.TrustedPeople.FindAsync(id);
              if (item == null)
              {
                  return NotFound();
              }   
              return item;
          }
  </code></pre>
  <p>and</p>
  <pre class="lang-cs prettyprint-override"><code>using Microsoft.AspNetCore.Authentication.JwtBearer;
  using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.AspNetCore.Http;
  using Microsoft.AspNetCore.Identity;
  using Microsoft.EntityFrameworkCore;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Hosting;
  using Microsoft.IdentityModel.Tokens;
  using shadow.Data;
  using shadow.Services;
  using System.Text;
  using Microsoft.Extensions.FileProviders;
  using System.IO;
  using shadow.Models;
  using Microsoft.AspNetCore.Authorization;
  
  namespace shadow
  {
      public class Startup
      {
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
          }
  
          public IConfiguration Configuration { get; }
  
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)));
              services.AddHttpContextAccessor();
              //services.AddCors();
  
              services.AddCors(options =&gt;
              {
                  options.AddPolicy(&quot;CorsPolicy&quot;,
                      builder =&gt; builder.AllowAnyOrigin()
                          .AllowAnyMethod()
                          .AllowAnyHeader());
              });
  
              services.AddSingleton&lt;IUriService&gt;(o =&gt;
              {
                  var accessor = o.GetRequiredService&lt;IHttpContextAccessor&gt;();
                  var request = accessor.HttpContext.Request;
                  var uri = string.Concat(request.Scheme, &quot;://&quot;, request.Host.ToUriComponent());
                  return new UriService(uri);
              });
              services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;(options =&gt;
              {
                  //options.Password.RequireDigit = true;
                  //options.Password.RequireLowercase = true;
                  options.Password.RequiredLength = 6;
              }).AddEntityFrameworkStores&lt;ApplicationDbContext&gt;().AddDefaultTokenProviders();
              services
                  .AddAuthentication(auth =&gt;
                  {
                      auth.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                      auth.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
                  })
                  .AddJwtBearer(options =&gt;
                  {
                      options.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                      {
                          ValidateIssuer = true,
                          ValidateAudience = true,
                          ValidAudience = Configuration[&quot;AuthSettings:Audience&quot;],
                          ValidIssuer = Configuration[&quot;AuthSettings:Issuer&quot;],
                          RequireExpirationTime = true,
                          IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration[&quot;AuthSettings:Key&quot;])),
                          ValidateIssuerSigningKey = true
                      };
                  });
  
              services.AddAuthorization(options =&gt;
              {
                  options.FallbackPolicy = new AuthorizationPolicyBuilder()
                      .RequireAuthenticatedUser()
                      .Build();
              });
  
              services.AddScoped&lt;IUserService, UserService&gt;();
              services.AddTransient&lt;IMailService, SendGridMailService&gt;();
              services.AddControllers();
              services.AddRazorPages();
              services.AddControllers(options =&gt; options.SuppressAsyncSuffixInActionNames = false);
          }
  
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
              //app.UseHttpsRedirection();
              app.UseRouting();
              // app.UseCors(options =&gt; options.WithOrigins(&quot;http://localhost:4200&quot;)
              //.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
  
              app.UseCors(&quot;CorsPolicy&quot;);
  
              app.UseAuthentication();
              app.UseAuthorization();
              
              // Server: https://shorten.news/static-file/content/10992.mp3
              // Local: http://localhost:5000/static-file/content/10992.mp3
              app.UseStaticFiles(new StaticFileOptions
              {
                  FileProvider = new PhysicalFileProvider(
                  // Path.Combine(env.ContentRootPath, @&quot;c:\audio\&quot;)),
                  Path.Combine(@&quot;c:\audio\&quot;)),
                  RequestPath = &quot;/static-file&quot;
              });
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllers();
              });
          }
      }
  
  }
  
  </code></pre>
  <p>Model</p>
  <pre><code>using System;
  
  #nullable disable
  
  namespace shadow.Models
  {
      public partial class TrustedPerson
      {
          public int Id { get; set; }
          public string Fullname { get; set; }
          public string AliasName { get; set; }
          public string Email { get; set; }
          public string PhoneNumber1 { get; set; }
          public string PhoneNumber2 { get; set; }
          public string PhoneNumber3 { get; set; }
          public int? RelationshipId { get; set; }
          public string About { get; set; }
          public int? AvatarId { get; set; }
          public DateTime? Created { get; set; }
          public DateTime? Modified { get; set; }
      }
  }
  </code></pre>
  <p>The response like</p>
  <pre><code>{
      &quot;id&quot;: 1,
      &quot;fullname&quot;: &quot;Do Xxx Xx&quot;,
      &quot;aliasName&quot;: &quot;Xx ham&quot;,
      &quot;email&quot;: &quot;xxdn@xxsolutioxx.io&quot;,
      &quot;phoneNumber1&quot;: &quot;0989878776&quot;,
      &quot;phoneNumber2&quot;: &quot;0989878777&quot;,
      &quot;phoneNumber3&quot;: &quot;0989878778&quot;,
      &quot;relationshipId&quot;: 3,
      &quot;about&quot;: &quot;Dep trai&quot;,
      &quot;avatarId&quot;: 42,
      &quot;created&quot;: &quot;2020-09-05T10:34:39.427&quot;,
      &quot;modified&quot;: null
  }
  </code></pre>
  <p>my friend want</p>
  <pre><code>{
      &quot;Id&quot;: 1,
      &quot;Fullname&quot;: &quot;Do Xxx Xx&quot;,
      &quot;AliasName&quot;: &quot;Xx ham&quot;,
      &quot;Email&quot;: &quot;xxdn@xxsolutioxx.io&quot;,
      &quot;PhoneNumber1&quot;: &quot;0989878776&quot;,
      &quot;PhoneNumber2&quot;: &quot;0989878777&quot;,
      &quot;PhoneNumber3&quot;: &quot;0989878778&quot;,
      &quot;RelationshipId&quot;: 3,
      &quot;About&quot;: &quot;Dep trai&quot;,
      &quot;AvatarId&quot;: 42,
      &quot;Created&quot;: &quot;2020-09-05T10:34:39.427&quot;,
      &quot;Modified&quot;: null
  }
  </code></pre>
  <p>(2)</p>
  <p>Is (2) best practice?</p>
  <p>How to keep case-sensitive in key of RESTful response like C# model?</p>