People who code: we want your input. Take the Survey

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
57
votes
4answers
163k views

Comma delimited string from list of items

Is there a simple way to create a comma delimited string from a list of items without adding an extra ", " to the end of the string? I frequently need to take an ASP.NET CheckBoxList and format the ...
19
votes
3answers
9k views

ASP.Net caching manager

I have a Cache Helper Class. ...
18
votes
2answers
87k views

Consuming an ASP.NET Web API call in an MVC controller

In a new project I am creating for my work, I am creating a fairly large ASP.NET web API. The API will be in a separate Visual Studio solution that also contains all of my business logic, database ...
17
votes
1answer
23k views

Using separate DBContext classes

I know that the DBContext represents a session (Unit-Of-Work and Repository) with the database, however I an unsure as to when I should have a different ...
14
votes
2answers
37k views

Using a BaseController in MVC asp.net to reuse the repository

I have a repository class that impliments a repository Interface. In my Controllers I want a way to access the repository without creating constructors each time in the controller. So now all my ...
14
votes
2answers
1k views

“Pluggable” routes in ASP.NET MVC

How do I handle multi-tenancy with routes in ASP.NET MVC? The application is a multitenant ASP.NET MVC 3 application. Tenants are identified based on hostname so this does not interfere with routing. ...
12
votes
5answers
8k views

Image resizing class

How does this class to resize an image look? ...
12
votes
3answers
3k views

Tracking sports statistics

I am designing a new application to track sports statistics with code-first migration. I have the bare minimum POCO setup. The problem is that I am not happy with the design specifically how the ...
12
votes
1answer
65k views

Making a simple call to a server

Earlier this year, before I learnt about Code Review Stack Exchange, I gave this answer in response to a question about how to combine ASP.NET, jQuery, and JSON: I keep thinking that there must be a ...
11
votes
5answers
2k views

Simple ASP.NET C# class design

Here's a class I'm designing: ...
11
votes
2answers
15k views

Display progress bar to show async request status using jQuery

Instead of using the ProgressBar plugin, this script displays the progress bar for async requests on the page. Could anyone provide any feedback on this, especially if there will be any issues like ...
11
votes
1answer
10k views

Generic ASP.NET MVC controller that generates many pages

I recently set out to create an open-source ASP.net MVC web development framework. Specifically, I wanted to automate some of the tasks associated with the creation of data-driven applications. I've ...
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 ...
10
votes
3answers
2k views

ASP.net custom user control design

I've built a custom control that generates a tab style navigation. Each page might have different tabs to display, the aim was to modularise it so I can make global changes to all the tabs. TabMenu....
10
votes
1answer
172 views

ASP controller for tracking equipment

This was originally posted here. I'm hoping Code Review will be a little more helpful in giving me a concrete direction. I've been working on a project based off of this tutorial. Unfortunately, ...
10
votes
2answers
804 views

Photo gallery user control

I am trying to create something that is very reusable here so that I can use it in other sites for other pages etc. This code is for a simple photo gallery, I took the code from here, but I ...
9
votes
2answers
16k 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 ...
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 ...
9
votes
3answers
575 views

Cleaning up a redundant switch statement

How can I use a more generic method to clean up the redundancy in the switch statement below? I'm working on an ASP.NET webforms app that will have five identical user controls that I will be showing ...
9
votes
3answers
2k views

Is there a better way to output a javascript array from ASP.net?

I often run into the problem of producing a javascript array on an ASP.net page from an IEnumerable and I was wondering if there was an easier or clearer way to do it than ...
9
votes
2answers
10k views

Conditional string building

Essentially I'm taking a number of checkboxes off of my view, adding them to a Dictionary<string, bool>, and writing out the ...
8
votes
3answers
11k views

Simple Google ReCaptcha validation

Linked: Google reCAPTCHA Validator: Iteration II I have also created a simple Google Recaptcha Validation class to handle verification. I used some code from CodingFusion's post Google New ...
8
votes
3answers
903 views

My Calendar generation code is slow. How do I improve it?

I have a model I have created to generate iCal and the necessary JSON for the jQuery calendar plugin Full Calendar to work. When I display the page, the JSON generation takes about 7 seconds. The ...
8
votes
3answers
932 views

Stack Overflow like pager

I've been working on a Stack Overflow like pager for my personal use and I've gotten everything working pretty good. Some of my logic is a bit suspect though, especially the logic in the Pager class ...
8
votes
4answers
106k views

Sending GET/POST requests in .NET

I have a RequestsExtensions class with two functions for sending GET/POST requests. ...
8
votes
2answers
1k 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 ...
8
votes
1answer
30k 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, ...
8
votes
1answer
4k views

First SignalR application (Connecting 2 clients; mobile and desktop)

Two days ago I started reading about SignalR and today I started writing a simple application. I have written the code below so far, but I was wondering if you have some tips to improve my code. ...
7
votes
5answers
14k views

Comparing string arrays

My code does what I need it to do, but I think I am missing the "right" way to do this with comparing the arrays. Essentially what I need this to do is compare a textbox entry against two different ...
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 ...
7
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 ...
7
votes
3answers
4k views

Parsing pipe delimited lines

I am parsing the following line of code via a specific format. Line is: S|111111|87654321|Bar UK|BCreace UK|GBP|24/08/2010| The Format is: ...
7
votes
2answers
2k views

Converting multiple query to use parameters to avoid SQL injection

I have some dropdownlist in my aspx page and I am using the choices from them in my SQL query: ...
7
votes
3answers
5k 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: ...
7
votes
3answers
444 views

Getting instant/better result instead of waiting at least 10 seconds every time

I have the following code that unfortunately is really slow: ...
7
votes
2answers
185 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
493 views

jQuery dialog for help popup

I used jQuery-UI and jQuery to create a dialog popup for help snippets on search form inputs. HTML (Calling Page) ...
7
votes
1answer
153 views

Displaying a video player to eligible users

I posted this on Stack Overflow, but it was suggested that I move it over to Code Review. I would like some feedback on the way I decided to clean up code from the in a .NET project that had ...
7
votes
1answer
80k views

ASP.Net, C#, and alert/display messages

We have a hidden div in a master page. When we want to display a message, we send a function a message to display, and it turns that div from .Visible false to .Visible true, and fills the div with ...
7
votes
3answers
1k views

3-layer ASP.NET app - Need critique/advice

My current setup is a 3 layered application: UI > BLL > DAL. Each layer is set up as a separate project. The UI is an ASP.Net website and the BLL & DAL are Class Library projects. I've shown some ...
7
votes
1answer
8k views

Using Identity to create user administration page

I'm developing an ASP.Net web application, using MVC 5. This application authenticates via LDAP and will assign an Identity Role of "Admin" to a designated user. The Admin user will be able to go to ...
7
votes
1answer
10k views

Identity OAuth implementation with Owin

I am building an MVC 5 application using code-first Entity Framework 6 and a customised ASP.NET Identity model for authentication. I will only be authenticating against external OAuth providers (...
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 ...
7
votes
2answers
109k views

Using Linq to select the first and last values

I want to get just the first and last values in a date range. I have the following code: ...
7
votes
1answer
174 views

Customized Template Login

While the MVC4 template provided by Microsoft is useful, I feel there are a few scenarios that should be covered to help out users trying to log in. Allow the user to log in with their email address ...
7
votes
1answer
391 views

Workflow and Design Feedback on an Add / Edit Form

I was looking for advice, feedback and information on best practices when designing ASP.NET Web Forms in a .NET web application. Allow me to post a sample of how I currently do things. I am omitting ...
7
votes
1answer
3k views

Dependency injection with asp.net identity and property injection with dbcontext

I configure asp.net identity using Simple Injector ...
7
votes
3answers
5k views

Is this a good way to catch all 404s in .NET without playing with IIS configuration?

The situation is that its not always possible to play with the web.config or have access to IIS, that being said I had to come up with a way to catch all 404s in a .NET application, for aspx page ...
6
votes
6answers
25k views

Username, Password and UserType Validation

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

Don't search for minors, it isn't allowed

I have a search form that doesn't require much in terms of input parameters, but the Date Of Birth is import for this particular search. I have been working on creating a way that the form can be ...

1
2 3 4 5
9