21
votes
Accepted
Don't search for minors, it isn't allowed
This part of the review is focused on the Javascript aspect of the answer
I will be really light on this review.
I will try to make it short and quick.
You have some mixed quotes.
Consider the ...
13
votes
Accepted
Username, Password and UserType Validation
Here are some observations:
you first iterate all rows in Credentials and then select the Password yet again - why not just select the pasword?
seems like your ...
13
votes
C# Am I using proper SOLID principles?
I suppose the simplest thing is to go through the principles:
SRP - Cannot see any 'too big' things in your example
OCP - The example is small enough and you are not using class
inheritance that I ...
12
votes
11
votes
Accepted
How to Make Strongly-typed References to Web.Config?
I don't do much asp.net, but if this StackOverflow answer applies then you could just do this:
...
10
votes
Accepted
Tracking sports statistics
Don't use underscores in identifiers. If that's how the database has them, use a ColumnAttribute to specify the column name scratch that, you're going code-first. ...
10
votes
Accepted
Converting multiple query to use parameters to avoid SQL injection
The recommended way to avoid SQL injection attacks is to use parameters.
Also I can recommend that you create a stored procedure instead of using dynamic SQL.
You can pass your dropdown indexes as ...
10
votes
Accepted
Simple Google ReCaptcha validation
private readonly string _ReCaptchaSecret;
private readonly string _ReCaptchaSiteKey;
private fields are either ...
9
votes
9
votes
Tracking sports statistics
I made a small example to show you that all your worries are in the past. Before you implement this yourself though, keep Mat's remarks in mind: I made this as a quick sketch and separating the ...
9
votes
8
votes
Accepted
Using properties efficiently in inheritance
Accessors in C#
You should read on accessors in C# - your setter does not do what it should - it should set the value if Cname. If this has no meaning (you can't ...
8
votes
Truncate port number from absolute Uri
I have witnessed the UriBuilder .port = -1 fix elsewhere. Frankly guys, it is a hack that really isn't a good production ready solution.
The right solution here is to use UriBuilder as follows.
<...
8
votes
ASP.Net caching manager
I would suggest one more solution how to make usage a bit easier. You can add this method into CacheHelper
...
8
votes
Sending GET/POST requests in .NET
First off your methods are not extension methods as the name RequestsExtensions would indicate. Not sure if this intentional or. If you want to make them true ...
8
votes
Validate and Add Service Provider/Location in C#
There are five lines that are repeated three times:
...
7
votes
Accepted
Can my code be made into one?
Per the comment, what you probably want is an abstract class MyAppPage:
...
7
votes
Generic ASP.NET MVC controller that generates many pages
This switch should be an if statement instead.
...
7
votes
Accepted
Should I split code into smaller functions? Advice on layout
I would basically write a method wherever you've written a comment on what a block of code does. This allows you to hide the specifics of a particular operation and makes it clearer which code paths ...
7
votes
Accepted
Searching through various PDF files
The major bottleneck is most likely in the ReadPdfFile method as we are dealing with a PDF file.
In your ...
7
votes
Accepted
Displaying a row of buttons
This can be shortened up quite a bit. First, you have presentation logic intertwined in your ASP code, which is the main cause for the code repetition. Shortening this code and DRY-ing it up involves ...
7
votes
Accepted
7
votes
Accepted
Audit table queries for various combinations of search criteria
First of all you should remove duplication. It's clearly that every if..else block has same code for filling DataTable and binding it to ListView. Move it to the bottom:
...
7
votes
Combating magic strings in a web application
First point, these extensions are really cool.
I don't have much comments to give, your code looks pretty good!
The ActionInfo class could be simplified a little :...
7
votes
Accepted
ASP controller for tracking equipment
Index
It would appear you primarily do three things here. Sort, Filter, and Page. There's not much to say about your paging, but the sorting and filtering logic clutter the action. Try creating an ...
7
votes
Accepted
C# Convert BLOB to jpg, resize, then back to BLOB
Welcome to CodeReview! I hope you get some good feedback.
Absolute paths
...
6
votes
Tracking sports statistics
I suggest to use the same name for primary and foreign keys following some consistent pattern:
It could be e.g. _id or Id, so you will have in PlayerAccount table the primary key PlayerAccountId (...
6
votes
Database connection approach
As @chrfin mentioned, this type of question is best suited for CodeReview.
This is the wrong way to use connections. Keeping a connection open indefinetely is bad because it accumulates locks, ...
6
votes
Calling many web services asynchronously
I'm not all that familiar with async/await (I really need to get going on this), but I find your code pretty clear, except why ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
asp.net × 455c# × 396
.net × 44
entity-framework × 36
sql × 32
vb.net × 29
javascript × 28
asp.net-mvc × 27
mvc × 24
performance × 21
asp.net-mvc-4 × 19
sql-server × 18
jquery × 17
linq × 15
asp.net-web-api × 15
beginner × 14
asp.net-core × 14
html × 12
design-patterns × 11
security × 10
validation × 10
asp.net-mvc-3 × 10
object-oriented × 8
database × 8
multithreading × 7