« first day (3686 days earlier)      last day (1278 days later) » 
04:00 - 10:0010:00 - 23:00

mr5
4:08 AM
o/ plebs
 
 
2 hours later…
6:20 AM
Buenos dias
 
6:39 AM
Umm, hey guys, how do I redirect to the login page if the user is not logged in? The code I have currently created can only prevent viewing the page.
@page "/Privacy"
@model PrivacyModel

@if (LoginView.LoginModel.IsLoggedIn == true)
{
	<p>Use this page to detail your site's privacy policy.</p>
}
else
{
	Redirect("/");
}
 
Use the force NavigationManager, Luke!
 
Do it in the init. This is the init method of my profile page:
	protected override async Task OnInitializedAsync()
	{
		if (!State.IsLoggedIn)
		{
			Nav.NavigateTo("/");
			return;
		}
		Console.WriteLine($"Current player: {State.CurrentPlayer}");
		player = State.CurrentPlayer;
		State.OnLoginStateChanged += StateHasChanged;
		await base.OnInitializedAsync();
	}
And the root goes to my login page
 
Ah!
Nice
Ty ;0
:)*
Hard to type while eating lol
 
Although I think there is a "built-in" way to do it, but I can't think of it right now. Like an attribute for the page or something?
Something to tell it it needs to have authorization, but then you'll have to do the auth stuff the "official" way too.
So I just got this lol
Works like a charm
Can't access /profile
(Also it's not in the nav when you're not logged in...
 
6:45 AM
@Squirrelkiller Can you explain me this answer too? It uses cookies instead. First will try your way though :)
 
Ah yeah that's the thing where it automagically sends you to the LoginPath for login if you access a site that needs authorization.
Just gotta figure out what attribute or whatever that was
Well and how your login tells the auth that you're authorized now
 
@Squirrelkiller LoginView.LoginModel.IsLoggedIn=true;
IsLoggedIn is a public static field
 
Yeah but how does the UseCookieAuthentication thingy know that?
 
@Squirrelkiller No clue. That's what
 
That's the point where I decided to roll my own lol
 
6:49 AM
oh!
okay :)
@Squirrelkiller What about this?
 
If you get the automagical way to run, I'd appreciate a repo I can copy it from :)
 
Sure :)
 
@d4rk4ng31 Ya same thing, some middleware decides when you're authorized and how to authorize you. Somebody's gotta read up on that a bunch.
 
@Squirrelkiller I wrote an even shorter code
public void OnGet()
{
	if(LoginView.LoginModel.IsLoggedIn == false)
	{
		Response.Redirect("/");
	}
}
 
Does it work?
 
6:56 AM
Yes
 
Nice
...OnGet? Doesn't look like Blazor WASM to me, what's that?
MVC?
 
.Net Core
MVC
 
Ah I see
 
7:10 AM
[SiT # 2] GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
@Squirrelkiller a small problem
How do I reset the IsLoggedIn variable once the user has logged out?
 
I have a button in the top right corner
	private async Task DoLogout()
	{
		Console.WriteLine("Submitted logout");
		await AccountService.Logout();
		Nav.NavigateTo("/");
	}
 
I have Log Out as a nav-link
 
mr5, you awake?
that's a definite no
 
@mr5?
 
mr5
7:24 AM
I'm still ded
 
@Squirrelintraining there you go :)
@mr5, how do I change the value of a C# variable when a link has been clicked?
 
[Hozuki Ferrari] Good morning!
 
mr5
7:42 AM
morning Roel. ur erli
 
[Hozuki Ferrari] Think so? It start my day at 8. Perhaps I'm normally more slow opening SO 😄
[SiT # 2] well now you got discord open 'right?
[Hozuki Ferrari] Yeah. That might be why.
 
8:34 AM
good morning
 
8:54 AM
@d4rk4ng31 myVariable = myValue;
if that is not sufficient, perhaps a bit more context is required
 
[Captain Obvious] IIRC he's brand new to C# and starting with blazor 🤣
 
im not sure why that is funny
 
[Captain Obvious] Because it's blazor
[Captain Obvious] And it's a nightmare
 
well... it cant be worse than web frigging forms
 
[Captain Obvious] It's like starting web development by going stright into Angular
[Captain Obvious] It's the modern day equivalent I guess
 
8:58 AM
I guess starting web development and diving straight into react might be interesting
considering the first step of learning react is to unlearn everything else you know first
 
Hello
i cant seem to be able to get cookies
 
[Captain Obvious] Well that might not be that bad
 
httpcookies doesnt exist in system.web, nor deos httpcontext or any other thing
 
perhaps your local supermarket can remedy that
 
i cant get or set cookies
 
mr5
8:59 AM
@d4rk4ng31 I'm not really sure how to do it.
 
[Captain Obvious] Go to the bakery or your local supermarket, they're usually pretty cheap
 
except with javascript which i dont wanna do
 
[Captain Obvious] @omer you're gonna have to give us some context
 
like
oh
im using asp.net mvc
with target framework as .net core 3.1
 
[Captain Obvious] ASp.net core? or the old one
[Captain Obvious] Oh sick, in that case you should find it fairly easy
 
9:00 AM
idk
 
how do you know there is no System.Web.HttpContext ?
 
[Captain Obvious] Are you trying to get/set the cookie in your .cshtml or in the controller?
 
it throws error
@Botler cshtml
 
mr5
System.Web is deprecated
 
[Captain Obvious] Okay one sec
 
9:01 AM
@mr5 ?
 
[Captain Obvious] I have examples either way
 
mr5
You should start using System.Net
 
[Captain Obvious] With setting the cookies, you either need to do that in the controller before you start retuning a view, or do it in the JS in your view
[Captain Obvious] But reading, there certainly is a Httpcontext
 
i wanna do in cshtml
on page load
 
[Captain Obvious] That would have to be js then
 
9:02 AM
but this.load += pageload throws error
load does not exist in this
@Botler cant i set cookie with c#
 
[Captain Obvious] Not after you've started rendering the view
[Captain Obvious] Cookies are sent in the header, which is sent before the content of the response (hence the name)
 
this is the project type i.imgur.com/beNCSrs.png
@Botler oh
 
mr5
why is it that everything on your part is throwing an error? 😂
 
so can i set using js then somehow reload and get cookie with c#?
 
[Captain Obvious] Once the view is being rendered, it's too late to send cookies or other headers
[Captain Obvious] I mean yeah I guess. Although if you're setting the cookie in the same request you're reading it then you should just store it locally
 
9:05 AM
so how can i get with c#
 
[Captain Obvious] That sounds a bit XY to me
 
leave setting
@Botler xy?
 
[Captain Obvious] eugh one sec
 
1722
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

 
9:07 AM
but can i get with c#?
 
[Omer H.] can i send from here?
[Omer H.] oh ok
[Omer H.] wait what
[Captain Obvious] Yes you can get the cookies from the .cshtml
[Omer H.] hows dat
[Omer H.] cuz every solution fails
 
Did my guy just move to the discord
 
[Captain Obvious] one sec I'm trying to find an example
[SiT # 2] Yes.
 
mr5
he's now part of the cult
 
[SiT # 2] Where where banend for saying "naughty" words
[SiT # 2] And iscussing them
[SiT # 2] Also we haz better channels and free-speech here.
[SiT # 2] + this awesome relay bot developed by lee while i was shouting at him
[mr5] So free like Americans
 
9:10 AM
mood
 
[SiT # 2] 😂😂
[Captain Obvious] <@!708964764516352030> In the CSHTML you should be able to do Context.Request.GetCookie("cookiename","defaultValueIfNotSet")
[Omer H.] Thx it works!
[Captain Obvious] 🙂
[Omer H.] and this.load still wotn work
[Captain Obvious] I use the same thing to do stuff in my cshtml
[Captain Obvious] What's this.load meant to be?
 
@CaptainObvious someone said that they prefer not to use JS and you throw an XY on them?
not using JS is a #1 priority
 
[Captain Obvious] No the XY was for setting and then immediately using a cookie in the same request
 
oh
 
can you make the relay bot from discord to SO filter the messages, so the bot doesn't get a suspend?
 
9:19 AM
[Captain Obvious] Probably
[Captain Obvious] Or somebody else could, as it is a public repo and I do accept PRs
 
what filter would that be?
 
[Captain Obvious] Probably a swearing filter or something
 
hmm...
 
[Captain Obvious] Can't stop it from sending out messages which contain no bad words but is "still inappropriate"
 
@Wietlol in the .cshtml code
 
9:21 AM
[Captain Obvious] "I touch kids" for example would be one. No bad words, but still unwise
 
then dont use .cshtml?
 
err no,
you see,
I have a static variable called IsLoggedIn in the LoginModel class
 
is the variable server side or client side?
 
When a user clicks on LogOut, I want it to change from true to false
 
you would generally do more than just setting it to false though
 
9:23 AM
@Wietlol .net core mvc
 
so... do the same as login does?
 
[Captain Obvious] but backwards!
 
@Wietlol opposite
 
obviously
 
mhmm
 
9:23 AM
[Captain Obvious] Nothing is ever obvious with you
 
@Botler stop!!
 
Are you sure a static variable is ok for the login state? When you have multiple users, static would mean all users are logged in, wouldn't it?
 
it is obvious to me :D
also... ye
what the murderous rodent said
 
@Squirrelkiller Currently, I have just one user
 
9:24 AM
[Captain Obvious] Who needs scalability
 
I'll change that once the user control has been added :)
 
[Captain Obvious] That's what the guy who wrote what I am working on was thinking
 
@Botler SHUT THE FUCK UP!
 
How the hell do you turn that thing off?
 
9:25 AM
 
pls dont make "make it work" your #1 priority
 
morning
 
first you design a solution, one that would be there to stay, then you make that work
 
9:26 AM
Someone banned me :(
 
[Captain Obvious] Yeah me
 
you said the S word
 
@d4rk4ng31 Botler serves as the relay between this chat and Discord, where some of us have migrated because of overly aggressive mods.
...sex?
 
@Squirrelkiller Post the link here please
 
I mean... I am not gonna say it or I get kicked too
 
9:27 AM
[Captain Obvious] It's posted in literally every message he relays
 
The link is in each of Botlers relayed messages, at the name of the sender of the message.
 
[Captain Obvious] 👀
 
the nono word
 
Ah! got it
Ty :)
 
9:29 AM
What does prevent "aggresive mods" to get aggresive on Botler? In fact is the user named Botler the one that says whatever is said in c# channel in discord
 
[Captain Obvious] Literally nothing
 
@li223 dont give me nono
 
nono
 
[Captain Obvious] What was bad s word anyway
 
-_-
that was not the quote
shame on you
 
9:30 AM
[Captain Obvious] I was sad because he told me to stfu
 
> SHUT
 
Nope, he told Botler to shut up
 
Hi all,
How to inject dependencies in ApiController, (*controllers need parameterless constructor!!)
 
[kesarling] <@!263075131323187203> sorry, I didn't know that bot was a relay
[Omer H.] hey this.load still doesnt work
 
anyways
 
9:31 AM
[Captain Obvious] Did you think it was an actual bot typing the messages or something
[Omer H.] lol
[Omer H.] AI
 
Are you on like. Asp.Net Framework.
 
[Omer H.] Context.Request.Cookies[] cannot be set, it is read only?
[Captain Obvious] <@!708964764516352030> you never said what you were trying to achieve
 
@li223 yes
 
[kesarling] Umm... I was thought the bot was being tested
[Captain Obvious] And yeah, obviously you can't change the request, but you can change the response
 
I was talking to someone else, should've pinged them
 
9:32 AM
\[**[Omer H.](https://discord.gg/PNMq3pBSUe)**] > <@!708964764516352030> you never said what you were trying to achieve
ik but i cant assign cookies like this?
 
@mshwf
 
[Omer H.] ohh right response
[kesarling] :sadcat:
[kesarling] :sadcat:
[kesarling] I got to get nitro
 
:sadcat:
 
Anyways, please explain how does one change the values from .cshtml file
I want to prevent the user from opening any other page
Unless they are logged in
 
[Captain Obvious] Use the authentication middlewares or Auth filters
 
9:34 AM
Boring task: Edit 300 stored procedures and remove their exception handling code. I do wonder... Why dont tell coders there is an stored procedure that doees the exception handling on publishing????
 
Authorize attribute?
 
[Captain Obvious] Seriously if you try to mangle something together you're just going to hate yourself later
[Captain Obvious] <@240562839109107712> because DBAs are arseholes
[kesarling] Ermm I actually found it hard to wrap my head around that stuff. Will you please explain how that exactly works? As in how does the AuthCookie Understand that the user has logged in?
[Captain Obvious] Well you still need to store that somewhere
 
@mshwf what we use is 2 constructors, one which accepts a service provider and one that asks for the service provider from a utility class
 
[Captain Obvious] All the filter does is decide whether or not to allow people access to certain methods/controllers
 
the utility class is where we register all the services and stuff
 
9:36 AM
oh a service locator
the most hated pattern in all circles
 
[Captain Obvious] Yeah, DI is a thing
 
that way, we have the parameterless constructor, but can still opt in with a custom service provider and test with special services
 
It would safe coders time! they do not have to use code snippets to inserrt their exception handling code, and withing Visual Studio code would be easier to read... Is a win-win
 
@misha130 What's that?
 
the thing that wiet is describing
 
9:38 AM
ServiceProvider is a service locator
 
WTF, in TSQL:

IF @pCategoria BETWEEN 1 AND 2

@pCategoria is INT!!
 
[Captain Obvious] omg just use dependency injection what is this 2004?
 
arent they using aspnet framework tho
 
@Wietlol That makes sense
 
[Captain Obvious] @clept I believe between is inlusive, that makes sense
 
9:39 AM
You could use an "OR"
 
[Captain Obvious] Definitely shorter than writing or though
[Captain Obvious] if @category = 1 OR @category = 2
[Captain Obvious] Nah, too long
 
which is less readable
 
[Captain Obvious] And between is more scalable
[Captain Obvious] Imagine if you had more than 2 categories
 
I would use @category in (1, 2)
 
same tbh
 
9:41 AM
but depending on how the numbers would grow, between makes more sense in some cases
I just rarely find to meet that case since we dont really do range checks that often
 
In makes more sense if your list is short and non-contiguoys
 
@Wietlol Easier to mantain
 
what am I saying?
 
between makes more sense if it is contiguous and longer than a couple
 
I would use Kotlin over sql
obviously I wouldnt use @category in (1, 2)
 
9:42 AM
I am in a pure database SQL Project
 
[Captain Obvious] tfw no orm
 
I would use sqlIf({ category in 1..2 }) { ... }
 
wait wtf
The "hot" stable isn't on the starboard anymore
 
it is on the pinned board
 
[SiT # 2] 120 new messages
[SiT # 2] u kids are cray cray
 
9:44 AM
@Squirrelintraining nah, it is just Botler spamming all day
 
we better ban him
 
Has it been removed for being inappropriate 🤣
 
@CaptainObvious ya i unpinned it to make room for other pins :D
 
9:45 AM
@CaptainObvious butt... it is still there
 
and sadly no, that owould have been funny though
 
It ain't on mine
 
It's not on the starboard, to old.
 
yes, it is still there
 
BUt it still exists
 
9:46 AM
second from top
 
HES TALKING ABVOUT THE PICTURE
U BABOON
 
or do you mean ANOTHER hot stable
 
Yeah
A picture of a hot stable
 
[SiT # 2] argh
[SiT # 2] this lion
[SiT # 2] no idea of dcrud
 
9:47 AM
dcrud?
 
baboon
 
[SiT # 2] baboon i tell you
[SiT # 2] d crud is worse than crud
[SiT # 2] it's d tier crud
 
Nov 11 at 10:20, by Squirrel in training
user image
It's fine it's still there
 
you are talking mad shit for someone in paws range
 
:wtfbro:
 
9:48 AM
tbf wiet you do say some dumb stuff
 
two separate work teams in the same project:
- A docen of Java coders
- Six database guys (I am in this group)
The client forbids dynamic queries (sp_executesql), but the Java group does have hundreds of dynamic queries.

It is gonna be really fun when client reviews the stored procedures
 
Someone star that
 
[SiT # 2] LUNCH!
[SiT # 2] ah cool i joust found out that one can press ctrl+k in discrod to quick switch channesl
[SiT # 2] like in slack
 
@Harry I do what I do best :D
 
[SiT # 2] + ctrl + k and enter is like alt + tab in channelverse
[Captain Obvious] Not just channels
[SiT # 2] yeah and servers
[SiT # 2] its like slack
[SiT # 2] the magi cbutton
 
9:51 AM
except in SO chat, where it means "switch between monospace font and proportional font"
 
It's Gamer Slack
 
[SiT # 2] AYE
[SiT # 2] wich is why discord is superior with this new relay cruf that lee made
 
I want to use slack but we decided that MS Teams was superior for some ungodly reason
 
I want to use MS Teams... at least I would then be able to come up with reasons to hate the program
 
teams video calls are better
 
9:52 AM
tbf never video called on Slack
 
Wanna kill them all...

	--When the Category is between 1 and 10 we retrieve data from TBNHColectivoRentaPFCH1
	--When the Category is greater than 10 we retrieve data from TBNHUnidadFamiliar
	IF(@pCategoria < 11 OR @pCategoria > 25)
		SET @vCabeceraSql  = 'SELECT @number_out = COUNT(1) FROM TBNHOpcionUnicaTributacion ou ' ;
	ELSE
		SET @vCabeceraSql  = 'SELECT @number_out = COUNT(1) FROM TBNHMejorOpcionTributacion mt' ;
 
I remember MS Teams got installed automatically
 
Teams just feels a bit clunky
 
and KEPT INSTALLING FRIGGING AUTOMATICALLY
 
LMFAO
 
9:53 AM
[Captain Obvious] Teams is superior
 
hes right yknow
 
so I have a predetermined hate towards MS Teams
 
[Captain Obvious] @wiet uninstall the Teams Machine-wide isntaller
[SiT # 2] yeah just like edge
 
I know
 
[Captain Obvious] Then it will stay uninstalled
[SiT # 2] nottin one can d to unisntall
 
9:53 AM
it is now permanently uninstalled... until it gets reinstalled
 
[SiT # 2] ms teams succes
 
at least Edge has a reason to be installed
you can use it to download a real browser
like Internet Explorer 7
 
Gotta download that Opera Browser the best browser ever created /s
 
[SiT # 2] you know its just a fork of firefox right?
[Captain Obvious] It's based on blink
 
@Botler Not sure if you wanted to write success or sucks lol
 
9:57 AM
firefox is the best browser ever created
3
 
[Captain Obvious] Firefox is the OG alt browser
[SiT # 2] wut no its a firefox fork
[SiT # 2] firefox + more tracking = opera
[Captain Obvious] You are wrong my dude
[SiT # 2] succs killerino
[SiT # 2] Nono, it's wednesday my dude
[Captain Obvious] That is correct
[Captain Obvious] <wednesdayfrog.jpg>
 
It do be Wednesday
 
[SiT # 2] i r winner
[SiT # 2] Weeping Wednesday
 
It's been an hour and I've done literally nothing :^)
 
@Wietlol so one: Ctor(IService service){_service = service}, and another: Ctor(){_service = Container.Resolve<IService>()}?
 
9:59 AM
[Captain Obvious] I've renamed some models"
 
04:00 - 10:0010:00 - 23:00

« first day (3686 days earlier)      last day (1278 days later) »