Questions tagged [asp.net]

ASP.NET is a web application framework developed by Microsoft to allow programmers to build dynamic web sites and web applications.

Filter by
Sorted by
Tagged with
-2
votes
0answers
21 views

What's the best practice element to use when allowing selection in C# website? [closed]

To display text where each word is selectable. Which Html element is recommended to surround each word. I would like it to be visible to the user and underline when selected. Then, a submit button ...
8
votes
6answers
13k views

Place try/catch in business logic or user interface

I found the following two types of exception-handling in Business Logic Layer. ASP.NET 3.5 Enterprise Application Development uses a similar method like the first one (I read it few years ago). I ...
2
votes
2answers
132 views

Best Practice for Button Event Handler

I have a button btnSearch and the event handler btnSearch_Click inside my asp.net web application, using web forms. (certain ...
2
votes
1answer
110 views

Parse meter readings from CSV file

I have a class representing meter readings: ...
1
vote
0answers
20 views

Access to IIdentity outside of aspnet application

My ASP.NET application references a classlib that contains the business logic, where I need to have access to the IIdentity of the "current user". In ASP....
1
vote
1answer
52 views

Asp.net core response caching with custom key values

I'm trying to build a response cache with custom key values (from headers and cookies). Here's the code I have so far, and it kinda works, but I need a second opinion or suggestions for improvements. ...
0
votes
2answers
77 views

How to replace the given email address with a value in a given input?

I have written the below method to replace some of the email domains like @gmail.com and @yahoo.com with a given text. ...
1
vote
1answer
80 views

.Net 5.0 Get User Email From Claims

From searching online I have identified two ways to get the user email, but I don't know if either has pro's/con's beyond Option.1 being a larger number of lines of code? Option.1 I have a dedicated <...
2
votes
1answer
68 views

Asp.Net overall design pattern integrating REST, dependency injection, and Hosted Services (See full project at Github)

I'm new to C#, and want to conform as much as possible to good design patterns. This code is the beginning of a Microservice, running as Asp.Net. It is based on a Microsoft tutorial doing similar work....
4
votes
1answer
6k views

Thread-safe wrapper around WCF ServiceModel.ClientBase subclass

I have an ASP.NET application which uses a Service Reference to a (third-party, offsite) payment processor. The service reference class is generated automatically. Its implementation is a subclass of ...
0
votes
1answer
122 views

Is this correct way to setup DB Infrastructure with repository pattern and Dapper

So, I am using Repository pattern with Dapper and ADO.NET. I have my based DB infrastructure setup as follows: ...
3
votes
0answers
3k views

Hosted service for queuing and running tasks in parallel in ASP.NET Core

I am attempting to construct a background service for an IIS-hosted ASP.NET Core project that basically queues tasks and runs them, and I decided to go with the ...
2
votes
1answer
108 views

Reviewing Basic API

I'm learning ASP.NET and I've created a few simple APIs, so I can consider myself maybe an intermediate beginner. I've decided to create a tutorial serving two purposes: to solidify what I've learned ...
1
vote
3answers
1k views

C# Asp.net core middleware for redirecting URLs

I wrote a small middleware for redirecting between WWW URLs. The most important thing that I want to change is to make it super fast. Here's what it is doing: If the host is localhost or mywebsite.com ...
0
votes
0answers
34 views
5
votes
1answer
2k views

Implementing SOLID Principles with C# Asp.net

I have started learning about SOLID principles yesterday. I've got a detailed explanation of SOLID principles here. After reading it, and a few other articles, I have tried to apply these principles ...
1
vote
2answers
297 views

ASP.NET Core async iactionresult

I am new to async methods and am kinda confused how async is working so what i want for you to do is review this code and tell me does implementing async like this is meaningless ...
1
vote
0answers
21 views

Adding multiple child entities to a parent entity when creating the parent entity

I have a form on a page to add a Post (parent), before submitting the form, a user should be able to add 1 or more Sections (children) to the Post. The form: ...
7
votes
3answers
2k views

C# Am I using proper SOLID principles?

I am currently practising using the SOLID principles in C#/.NET I have made a little example, but i am not sure if i have followed it correct. Its a simple example where i have an API controller that ...
3
votes
1answer
678 views

Validating the model outside of the controller in ASP.NET

I wasn't quite sure whether I should do it this way or create a validation service and inject it, but this works: Controller: ...
0
votes
0answers
68 views

Vue.js in legacy web application

I'm working on modernizing legacy ASP.NET WebForms site which heavily relies on doing AJAX request for client-side rendering. Without the use of vue-cli compiling <...
8
votes
2answers
2k views

C# Convert BLOB to jpg, resize, then back to BLOB

I am trying to convert a BLOB that is stored in a database to a JPG and then I need to display it on an ...
1
vote
1answer
92 views

Validating a name with C#, ASP.NET Core 3.1 and Regex

This class validates that a name contains only letters and optionally spaces, hyphens and apostrophes. ...
3
votes
2answers
1k views

Validating a date with C# and ASP.NET Core 3.1

I have a simple class to ensure the date entered into a form is a valid date. Where can I improve it, have I missed anything? ...
6
votes
2answers
1k views

ASP.NET Core 3.1 AddHttpClient call that includes a call to the database

So, I have an ASP.NET Core 3.1 web site that makes occasional calls to a vendor's RESTful API. I use the HttpClient class to perform these calls. Currently, the ...
5
votes
1answer
2k views

Proper way to display form with filtering in ASP.NET MVC 5

I want to create page when user can use form to display filtered data in table. Form has to remember its own state, because after every refresh it shouldnt change. So after submitting form I should ...
1
vote
1answer
60 views

Decoupling of validation and data access in ASP.NET

I've been asigned to a project no dev has touched in a long time. It's an ASP.NET MVC 4 application. It appeared to be well coded, but had no testing and the database migration folder is not present. ...
3
votes
0answers
33 views

Prettified GridView: is this JS code concise?

I been writing code for my company for years and there is never any constructive criticism for what I do. I am the only developer here and I would appreciate your opinion on this web page I made. It ...
1
vote
1answer
268 views

ASP.NET EF seed one to many relation

I am creating a simple model relation in ASP.Net core. My model relations are like this: A user can have many posts A post can have many comments A user can have many comments Now I am trying to ...
2
votes
1answer
226 views

Passing a true/false value to a model used in a controller

This passes the value of true/false to model which I can use in my controller. How can this be cleaned up? ...
-2
votes
1answer
61 views

Is it good practice to use try catch only for a part of the code [closed]

When I submit the form, I need to validate the input data from an HTML form field, which comes from the user who submitted the data. So inside the Page_Load event, ...
3
votes
2answers
150 views

Asynchronous catalog with paging and partial views

I'm trying out .net core with mvc in a personal project, the latest functionality I've added was a project catalog, primarily ajax based, it's displaying a list of projects fetched from the database ...
1
vote
2answers
68 views

Collecting 3 years of data and building a string

I am collecting 3 years of data and building a string that will be used with an ASP Literal control. The method GetListOfMeetingBygroupId takes in a ...
2
votes
1answer
440 views

Extension method for getting custom Principal Claim

I'm writing extension methods to shorten the code required to get custom Claims from an IPrincipal. I have two general forms for ...
2
votes
1answer
10k views

Calculating the total of each column and display in footer of gridview in DataTable

I've used this code to get the sum of the values of each column and display in footer. Here, the advantage is that I don't have to look for the column name, just get the count of total number of rows ...
3
votes
1answer
89 views

Refactoring code to implement clean code using repositories

I've been refactoring code today, try to implement a clean code setup using repositories. Is this on track? Can any improvements be made? ...
0
votes
1answer
99 views

Asp.net middleware [closed]

This code is asp.net core middleware written in f# and called from c# for a blazor server-side app. How can this be made more efficient if any in regards to the async code. F#: ...
9
votes
1answer
4k views

Database Class Creator

Overview I've written a class that will create C# code. The output is a single .cs file for each table in the default database (the database is defined inside a web.config file). I'm looking for a ...
6
votes
2answers
9k views

Database access class

I'm looking for any comments or feedback on my database access class. Security and speed are two things I'm most concerned about. One thing to note is this class has to work in a C# .NET 2 ...
4
votes
1answer
19k views

How to correctly use lock when adding/renewing cached data in asp.net cache?

This is sort of a follow up question on https://stackoverflow.com/questions/754661/httpruntime-cache-best-practices/11431198 where a reply from frankadelic contains this quote and code sample from ...
1
vote
2answers
330 views

Partition TPL Tasks in ASP.NET 4.0 for WCF Service

I would like to know if using partition code like this is ok to do to partition tasks in ASP.NET 4.0 inside of a WCF service. My goal with this code is to try to do non-blocking calls without ...
2
votes
1answer
94 views

Hosted service which perform CRUD operations in high update environment

I have this hosted services which garbs the data from the API and save it in the database. But before saving it checks if the data already exists in the DB if not it creates the new row and if it ...
3
votes
3answers
15k views

Search using stored procedure

I want to search a DB table and display the records in a gridview below is my stored proc ...
3
votes
1answer
75 views

Logic is stored in Components that receive input data and update output data via Observables

I have C# ASP.Net Core Webapi application that makes some calculations for physical models. I have this project class: ...
2
votes
0answers
754 views

Ninject binding for Dbcontext

I have an asp.net web API and I am using EF6 to connect to a third party rest API which sells online game codes. We made a deal with the company so clients have to call my rest API in order to get the ...
1
vote
1answer
44 views

Update any controls' Text for the specified language [closed]

I would like to optimize the below code The only difference is the datatypes RadioButton, Label, and Button. Outside the method I have an loop that iterates over all the controls in the aspx-page. I ...
1
vote
0answers
74 views

Bookmark controller with IMemoryCache

I'm just doing a small hobby project to solve a little problem I have and I'm using it as a learning exercise for ASP.Net MVC 5, .Net Core 2 and Bootstrap. I'm using a nuget package that handles ...
2
votes
1answer
230 views

Encrypts using AES GCM for data with limited visibility and long rest

This is the third iteration of my venture on creating an encryption/decryption solution. I asked a question here, which led to this question here, which led to this answer here, which led me to ...
1
vote
1answer
370 views

Encrypts using AES with random initialization vector meant for data with limited visibility and then long rest

I've done some research, reviewed countless SO questions that appeared similar, leading me to endless rabbit holes. My solution is working, but I don't like it. I want to create a random IV for AES ...
7
votes
2answers
19k views

ASP.net Identity admin reset user password

I have an application which uses ASP.net Identity as for its user authentication. I do not wish for users to reset their own password (for reasons which are not relevant here), so I have developed ...

1
2 3 4 5
10