nahr
nahr
Explore posts from servers
CC#
Created by nahr on 1/9/2023 in #help
❔ Authentication with owinCookie
Hi, I have an issue with the ExpireTimeSpan prop.
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddOwinCookie(CookieAuthenticationDefaults.AuthenticationScheme, 3, options =>
{
options.Cookie.Name = "random";
options.ExpireTimeSpan = TimeSpan.FromMinutes(1);
options.LoginPath = "/Account/Login";
});
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddOwinCookie(CookieAuthenticationDefaults.AuthenticationScheme, 3, options =>
{
options.Cookie.Name = "random";
options.ExpireTimeSpan = TimeSpan.FromMinutes(1);
options.LoginPath = "/Account/Login";
});
Why does not the cookie get cleared after 1 minute? If I add IsPersistent = true it works... but I dont want to use IsPersistent = true
var authProps = new AuthenticationProperties
{
IsPersistent = true,
IssuedUtc = DateTime.UtcNow
};
var authProps = new AuthenticationProperties
{
IsPersistent = true,
IssuedUtc = DateTime.UtcNow
};
Any ideas? Thx!
2 replies
CC#
Created by nahr on 12/5/2022 in #help
❔ Asp net core routing
Hi, I would like to build a folder structure like this: -Controllers (folder) -Products (folder) NewProducts (controller) OldProducts (controller) Foo (controller) Bar (controller) -Views (folder) -Products (folder) -NewProducts (folder) index.cshtml details.cshtml -OldProducts (folder) index.cshtml details.cshtml My issue is that the the views cannot be found
3 replies
CC#
Created by nahr on 11/21/2022 in #help
❔ How to bind DateTime in query parameter?
Hi, any tips how I can pass a DateTime as a query parameter? I'm doing an Http request from one api to another. Usually I would do a post request and pass DateTime in the body, but now I need to use this existing endpoint with DateTime as a queryParam, but it fails. Any ideas?
4 replies
CC#
Created by nahr on 11/15/2022 in #help
❔ Async Tasks (utility)
Hi, guys. Been doing some refactor work and been upgrading an old project from sync to async. But I'm not really sure if it's worth to upgrade smaller utility methods to async Tasks. Microsoft says that I/O-bound code and CPU-bound code should be async. So I have upgraded all my actions methods in the controllers, wrapper methods, repo methods. But for instance what about a minor utility method that is called from an async Task in my controller, should it also be async?
13 replies
CC#
Created by nahr on 9/30/2022 in #help
Logging EF-core exceptions
Hi, I'm doing some refactor for logging db exceptions. What's good practice when logging db exceptions? Atm I think it's good enough to just log the exception because then I get the full stack trace and all info even tho some info might be bloated? My PL asked me If I could log more specific info about the exception but I don't really see the point. Any suggestion or thoughts how you guys would do it?
4 replies
CC#
Created by nahr on 9/28/2022 in #help
Troubleshooting Visual studio .net 6, debugger
Hi, Ran in to a so strange bug/problem this week. I'm working in a multi tier solution with several projects and running the startup on a single project depending in other projects. Two days ago my debugger stopped working, it just says "the source code has changed, breakpoints won't be hit" (something like that") I have been spending a lot of time at google trying out different things. If I delete bin and obj folders in each project and rebuild them with dotnet build the debugger start to works again! BUUT, If i do a single code change in any projects the problem gets back. It's so frustrating, ofc I can solve it with go into every project and delete bin and obj folders and the rebuild. But this is time consuming and really ruins the joy of development. One things I did notice, it feels like when restarting the debugger that maybe some project is not terminated, not really sure here tho (need to dive deeper here today) Any ideas?! Thanks in advance
2 replies