Dot.Net Developer

Dot.Net Developer UnRuled Developing with Microsoft .Net Technologies.

11/10/2019

In .Net Core 3, If you set session and when you try to get session value back,if you get null value, please make you added the following in Startup.cs file
services.AddSession(); and app.UseSession();
and also make sure to add the following code

services.Configure(options =>
{
options.CheckConsentNeeded = context => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

Best of luck😎

07/10/2019

(In .NET Core 3.0) In Dubbing mode in Visual Studio, If you tried to edit Html or Css and tried to refresh page, and the page content not updating, then here is the solution

Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

NuGet package.

and then

services.AddMvc().AddRazorRuntimeCompilation(); (in startup.cs)

this will solves the problem and once you saved edited .cshtml, and refresh the page in dubbing mode, changes will reflect in b😀rowser. Cheers... Happy coding

26/09/2019

In .Net Core 3.0 ASP.NET MVC, do not use Async in method name (ex : LoginAsync)

Full Example:
public ActionResult LoginAsync(NewModel model)

There will be simple 404 Page Not found error.

Reason : Not Known.

25/09/2019

In .net core you can add AutoValidateAntiforgeryTokenAttribute in Startup.cs file, So there is no need to add controller or action attribute ([ValidateAntiForgeryToken]) (dependency injection)

So add this to Startup.cs

services.AddMvc(options => options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute()))

and then add below to view page .cshtml
AntiForgeryToken()

and in ajax call something like this

$.ajax({
type: "POST",
url: '.Action("actionName", "ControllerName")',
beforeSend: function (request) {
request.setRequestHeader("RequestVerificationToken", $("[name='__RequestVerificationToken']").val());
},
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) { }.....

Address

Naas Road
Dublin
22

Alerts

Be the first to know and let us send you an email when Dot.Net Developer posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Dot.Net Developer:

Share