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
-4
votes
0answers
20 views

SqlDataAdapter Fill DataTable Causes Memory Leak [on hold]

I have a very strange problem where when I Fetch data from SQL DB through DataAdapter the memory in the application pool increases around 250k-300k. I tried explicitly disposing the Adapter, ...
3
votes
3answers
14k 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
57 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
136 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
43 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
26 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 ...
3
votes
1answer
913 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 ...
2
votes
1answer
40 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
47 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 ...
6
votes
2answers
16k 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
vote
0answers
56 views

Helper class for ASP.net to return data from SQL server

My goal is to create a class that I can call from my webpages like this. Similar to a data access layer? ...
0
votes
2answers
37 views

The function to convert an object to a URL string

There is a function to convert object to the GET parameters for the ASP.Net controller. Is it possible to minimize the redundancy of the code, but not to the detriment of its readability? ...
0
votes
1answer
36 views

StringBuilder returing Web script

Task : With the page_type and currentpage param I made this code that returns the web script of the web page with active class on the current page through aspx behind code. Is there a better and a ...
3
votes
1answer
552 views

Online examination portal for learning

I am new to ASP.NET and I just developed a simple online examination portal for learning. I used ADO.NET, MySQL and developed in VS 2010. I have a login page in which the user can login and register ...
-1
votes
1answer
55 views

Check if mail contains a single page pdf and transfer to other folders

This code checks if a mail message contains a single page PDF attachment. If yes, it adds it to a processed list else rejected list. If mail can be processed, then it saves the attachment into a file....
8
votes
1answer
28k views

Creating a TreeNode hierarchy in C#

The following function accepts a list of Topic entities, retrieved from a database using LINQ-to-Entities. Each Topic has an Id, ...
7
votes
2answers
134 views

ASP.NET HTML code generation, two approaches

I was asked to give more context. So here we go. We want to create some HTML in code behind to add an "add" and a "refresh" button to a grid view header column. Approach #1 does this using string ...
7
votes
1answer
2k views
4
votes
1answer
3k views

asp.net core - get User at Service Layer

I use ASP.NET Core 2.1 and would like to fetch User at a service level. I've seen examples when HttpContextAccessor gets ...
2
votes
1answer
124 views

Displaying all application errors in a view

I'm learning ASP.NET Core with MVC pattern and I didn't find anything useful related to this argument. Actually I'm looking ...
6
votes
6answers
24k views

Username, Password and UserType Validation

I have two tables in the database: Credentials (userid, password, usertype) Customer (...
4
votes
1answer
20k views

Update SQL database with using statement and SqlParameters

I'm just starting out to learn all about sql databases. For now based on previous suggestions that was given to me online, I've incorporated a using statement to avoid problems in sql connection and ...
3
votes
2answers
107 views

Subscribe to Event form one service to another

In my architecture I have service layer, and for my question two relevant classes in this layer: UserManagementService EmailSenderService In first service there is method: ...
2
votes
1answer
2k views

Async await multiple API calls

I have an application that needs to contact a remote API many times to request information about various products. It was taking around a minute with synchronous programming. I adjusted all my methods ...
-1
votes
1answer
2k views

ASP.NET MVC multi language website

What is the best way to make an ASP.NET MVC multi language website? The following code is what I use, but I need to make sure from your real-world experience that my code is the best way for ...
1
vote
1answer
94 views

Getting value from session if available, if not, take from the database

This method is a constructor that has to decide which URL to add to the response header as Allow-Origin. i am actually adding the Allow-Origin later according to the value of PermittedOrigion variable....
5
votes
1answer
578 views

Convert IEnumerable<Reads> to CSV

I have an IEnumerable of a view model that I need to convert to CSV and send back as a file response. I have written it out quite manually and I'm just seeking code ...
3
votes
2answers
110 views

Image Database Service

I created simply database service with get, insert, get all image names and verify exist method. All images will be store in blob storage with unique filename + postfix size. Next one I have image ...
3
votes
1answer
3k views

Giving error response in Web API

I'm creating a Web Api in .NET Framework that is connected to an ASMX service. No own logic, just pass through data. Everything works as expected. But not sure if it's good. Have to repeat the same ...
2
votes
0answers
109 views

How to optimize code to only pull separate table rows that are necessary

I have a Company Class, and separate normalized Address Class. I did this because the Address table will hold more than just Company Addresses, so I don't want "CompanyAddress", "EmployeeAddress", "...
2
votes
1answer
97 views

Retrieving XML data

I am using the following function to receive XML data from a URL. Is there a more efficient method for retrieving this XML data? ...
2
votes
1answer
115 views

UserStore implementation for two databases

I created our UserStore class to use it with our custom database membership. We use two databases: AMDbContext host the main ...
1
vote
2answers
138 views

Function to download anonymous type data into excel

As far as I know, I cannot create function to accept anonymous type as parameter and I am reluctant to create new class to store those anonymous type because their difference is ...
1
vote
1answer
1k views

Implementing integration tests in ASP.NET core using InMemory database

I am building a web application using ASP.NET core. Most of the tests in my application are unit tests, so I mocked every dependencies in order to have fast unit tests. On the other hand I am of the ...
8
votes
2answers
12k views

Truncate port number from absolute Uri

We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e Actual: https://mysitename:443/Home/Index ...
7
votes
3answers
4k views

How to Make Strongly-typed References to Web.Config? [closed]

Let's say I have a configuration file with a property in it: <add key="LoadedCode" value="L" /> I know I can reference this using the ConfigurationManager: ...
4
votes
1answer
916 views

Runs a MySQL query, returns Dictionary<string, string> or false;

I've been practicing C# and ASP.NET, and have been working on a somewhat larger-scale project than I am currently used to. I am sure there are horrible things wrong with this code that I will find out ...
2
votes
4answers
1k views

Find consecutive numbers and turn them into ranges

I have array int[] arr = { -2, 0, 1, 2, 3, 4, 5, 8, 9, 11, 13, 15, 18, 22, 25, 28, 29, 30 }; I need to write function that shows it as string and if numbers are ...
0
votes
1answer
80 views

Get Users and related roles and show on View

I have 3 tables. Users, Roles and RolesToUsers Here is User model: ...
2
votes
1answer
72 views

IsDatabaseUp returns true or throws exception

I want to write an ASP.NET Web API endpoint that allows clients to check if database is running. The method below is check if database is up by establishing a connection and running a dummy sql ...
6
votes
2answers
282 views

Update SQL database, similar-but-different queries for each month

This snippet works and does as desired, but I just wonder if I am being too repetitive. What I mean by this is, eventually I will have all 12 months in there. So.... 12 Update Queries, 12 Commands, ...
4
votes
1answer
221 views

Generic class for Unit of Work pattern

In my project I use the Unit of Work pattern and it works really well. The implementation is the following: ...
1
vote
1answer
610 views

Change Background Color of ASP:GridView Based On Text

I am using the OnRowDataBound() event to change the Row.BackColor based on the text. Now my issue is, this is extremely slow. ...
11
votes
1answer
3k views

Injecting SelectList objects into ViewData to enable using EditorFor on dropdown based properties

I have developed a system whereby I use an attribute to state which SelectList to use for an 'FK' property. I would appreciate some feedback mainly on by good ...
2
votes
0answers
447 views

RESTful API combining three other APIs

I have created a RESTful API that uses three other APIs with Visual Studio 2017 in .NET Core. It is the first time I have ever programmed in .NET so I am sure the code could use a lot of improvements. ...
1
vote
0answers
79 views

Populating a container with dynamic pairs of connected sortable lists

I am working on an application which is used to assign work to Operators based on the Category of the work. Each Operator has several Categories of work they are qualified to work on. They have a ...
3
votes
4answers
153 views

Query URL parameters in downloading pictures from network cameras

I have some URLs saved in my database, to download pictures from network cameras. Because each camera has it's own URL and parameters, we have to store the entire URL in a field in the database. My ...
2
votes
2answers
3k views

Simple login user authentication

I've created a simple User Login page. Here User is authenticated [username, password] and if it is a valid user, values like username, name and role of the user is ...
4
votes
1answer
838 views

Cross-browser double form submit prevention

We developed a potential solution for the double form submit prevention and we need some review on it. To be able to execute this code on asp.net we needed to add our function call directly into the <...
1
vote
1answer
308 views

Calculating difference in time

In table first value I have value with datatype = Start I need to calculate difference first value - midnight Last value is ...