skip to Main Content

Saving JSON to DataTable – Asp.net

I need to save data retrieved from API to a DataTable. JSON which is returned from API can't be deserialized directly to DataTable using this code: DataTable dt = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable))); I got an error: Unexpected JSON token when reading…

VIEW QUESTION

HTTP Error 400. The request hostname is invalid. On IIS when using `AllowedHosts` appsettings property – Asp.net

I get the error HTTP Error 400. The request hostname is invalid. on swagger when configuring CORS using the AllowedHost property. var origins = Configuration["AllowedHosts"].Split(";"); services.AddCors(options => { options.AddDefaultPolicy(builder => { builder.WithOrigins(origins) .AllowAnyHeader() .AllowAnyMethod(); }); }); But if I use…

VIEW QUESTION

asp-route-id always pass id as query parmeter – Asp.net

I'm trying pass id as route parameter by asp-route-id always pass as a query parameter and I don't want to use href <a asp-area="Employe" asp-controller="PersonManager" asp-action="UserDetails" asp-route-id="@Model.Provider.Id">details</a> the route is like this https://localhost:5002/Employe/PersonManager/UserDetails?id=b4065ff6-c7bd-4244-a6b6-9bc6b7b4c7a8 but I want be like this https://localhost:5002/Employe/PersonManager/UserDetails/b4065ff6-c7bd-4244-a6b6-9bc6b7b4c7a8…

VIEW QUESTION
Back To Top
Search