All Questions
Tagged with asp.net-core-mvc asp.net-core-2.0
505
questions
1
vote
0
answers
92
views
Bulk Insert data from Excel to SQL database that contains foreign key
I have an Excel file with up to 4000 rows and 10 columns of data, and I want to insert these records into the database.
Some columns are titles of another table of the database and I must find Id of ...
0
votes
1
answer
425
views
How to get Antiforgery token before sending response?
I have ASP.NET Core application which auto validates every POST request for AntiforgeryToken:
services.AddMvc(options =>
{
options.Filters.Add(new AuthorizeFilter(...
0
votes
0
answers
313
views
How to add HTML attribute without attribute name using TagBuilder?
I am building a Input tag using TagBuilder. I want to build the input tag like below
<input name="IsOkay" type="checkbox" {% if MyObject.IsOkay == true %} checked="checked&...
0
votes
0
answers
313
views
Dynamically serve all files in a certain folder only after providing password in .NET Core 2.2
I have a web app in .NET Core that serves all files in a certain folder. Now before serving the files, a password is needed. Is this code sufficient or is there a loophole in it?
using DownloadFiles....
1
vote
1
answer
1k
views
how to post data without passing it to model .Net Core
I have this in my view
<form class="d-inline-block" asp-controller="">
<div class="form-group mb-2 d-inline-block">
...
1
vote
0
answers
252
views
Session Expires after 15-20 Minutes in asp.net core 2.0. Any solution Not working
Hello Buddies I hope you all good. I am having session expiration problem. it took weeks but not solved
yet I hope I will get help from here.
services.Configure<CookiePolicyOptions>(options =>...
1
vote
1
answer
4k
views
How to logout ClaimsIdentity User when using OpenIDConnect
I have ASP.NET Core application that is using OpenIDConnect authentication. In OnTokenValidated event i check if Authenticated user exists in the my application's database, and if not then i am ...
0
votes
1
answer
471
views
How to get app insights working on an azure webjob with .net core 2.x?
I have a webjob with .net core 2.1
I have an instrumentation key on the appsettings.json.
and I have this on the method ConfigureServices in program.cs
services.AddApplicationInsightsTelemetry(...
6
votes
2
answers
1k
views
Pass sub object to partial view from views with different models, have it bind when form is posted
I have an ASP.net MVC Core 2 (can upgrade to 3 if required) web app.
There are several different classes, landlord, tenant, contractor - they each have an address object, and other different ...
3
votes
1
answer
3k
views
How to read Windows environment variables on dotnet core?
I am building a Web API using dotnet core 3.1 and now I got into the need to store a kind of sensitive information on a Windows Environment variable which I already did. Let's call it MY_WIN_VAL_X.
...
0
votes
2
answers
1k
views
Where does this C# HttpContext context in Startup.cs come from?
So I came across this RazorPages sample code
using Microsoft.AspNetCore.Mvc;
// This method gets called by the runtime. Use this method to add services to the container.
public void ...
0
votes
1
answer
164
views
I am unable to store data into database using Entity Framework Core and Ajax
I have a problem with my code. The problem is I am not getting post data by parameter using ajax.
Can anyone fix this? The code is shown below.
This is Javascript Ajax code where I am sending data ...
0
votes
1
answer
1k
views
How to post List of Dictionary
I have a client ( in this case POSTMAN) that is posting collection of object. The properties of the object are not known in advance so I cannot use concrete C# model.
So I am using Dictionary<...
2
votes
1
answer
2k
views
Relative Path for Sqlite database via DbContextOptionsBuilder.UseSqlite?
I have a .Net Core 2.2 project where the back-end needs to open a DbContext to a Sqlite database.
I need something like:
optionsBuilder.UseSqlite(@"Data Source=Data\Database.db");
However the ...
0
votes
0
answers
79
views
reading 500 MB xlsx file with OpenXML in aspnet core 2.1 is giving stream is too large
Reading 500 MB xlsx file with OpenXML in aspnet core 2.1 is giving stream is too large.
is it any other way to read 1 gb excl file in openXML
below is my code
using (Stream stream = new FileStream(...