Misunderstandings in C# and .NET Regarding SQL Injection

In this section, we will discuss SQL injections, a persistent issue that requires careful attention due to its serious implications. Let’s delve into this problem. Imagine we have a query that retrieves the "city" value from a submitted HTML form, and we decide to insert this input directly into our SQL query like this: Using dynamic SQL queries in this manner should be avoided, especially when the input comes from users. What could go wrong?...

Common Misconceptions in C# & .NET: Overlooking Client Validation

Relying exclusively on client-side validation should be avoided at all costs. This approach is unreliable, as knowledgeable users can easily manipulate client-side code to circumvent validation rules. Let’s consider an example to illustrate this. In our scenario, we have a Razor Pages application featuring a login form. The form employs bind property attributes in the code-behind to associate form values with attributes. We’ve implemented...