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

learn more… | top users | synonyms

31
votes
4answers
31k 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 ...
12
votes
1answer
2k views

Fluent LinkedIn REST API client interface design

There is a handful of LinkedIn clients written in C# on the NuGet package library, but afaict most only do authentication via LinkedIn. I found a couple which offer a linkedin rest api interface. Of ...
11
votes
6answers
6k views

c# image resizing class

how does this class to resize an image look? All comments welcome, no matter how nitty :) ...
11
votes
3answers
174 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 ...
10
votes
3answers
405 views

ASP.Net caching manager

I have a Cache Helper Class. ...
10
votes
2answers
10k 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 ...
10
votes
2answers
703 views

Advice regarding “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. ...
9
votes
5answers
2k views

Simple ASP.NET C# class design

Here's a class I'm designing: ...
9
votes
3answers
604 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
1k views

Display progress bar to show async. request status using JQuery

Instead of using ProgressBar plugin, I've below script to display the progress bar for async. requests on the page. Could anyone provide any feedback on this esp. if there will be any issues like ...
8
votes
3answers
347 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 ...
8
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. ...
8
votes
1answer
43k views

Basic Simple Asp.net + jQuery + JSON example

Earlier this year, before I learnt about Code Review StackExchange, I gave this answer in response to a question about how to combine ASP.net, jQuery, and JSON: ...
8
votes
1answer
584 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 ...
8
votes
2answers
8k 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
3answers
642 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 ...
7
votes
3answers
387 views

How to optimize this code to get a instant/better result instead of waiting at least 10 seconds every time?

I have the following code that unfortunately is really slow: ...
7
votes
3answers
1k 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
5answers
4k 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 ...
6
votes
3answers
715 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 ...
6
votes
2answers
192 views
6
votes
2answers
315 views

Web service getting value using LINQ from queue table in SQL database

As a test of my C# skills, I have been asked to create a simple web service which will take a message from a queue table in a SQL database and send it to a web application when a button is pressed on ...
6
votes
2answers
174 views

How to Make Strongly-typed References to Web.Config?

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: ...
6
votes
3answers
138 views

Advice on “Factory” Pattern Implementation

I'm refactoring some code around a couple of ASP.NET Web Forms pages and decided to try out a variation of the Abstract Factory pattern of my own design. I need to create an implementer of an abstract ...
6
votes
2answers
757 views

WebAPI - Return models vs entity and partial class with meta data

Wanted some opinions on something I have been working with, I've tried a few ways of structuring the way I retrieve and return data to my WebAPI, and I'm pretty happy with what I have so far, but I ...
6
votes
1answer
18k 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 ...
6
votes
4answers
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 ...
6
votes
1answer
66 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 ...
6
votes
1answer
552 views

Is this nesting of partial views poor design?

I feel like using this many partial views where a view renders a partial that renders a partial is just digging a hole of poor design, so I'm looking for any suggestions or guidance as to if this is ...
6
votes
1answer
281 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 ...
5
votes
5answers
434 views

Username, Password and UserType Validation

I have two tables in the database: Credentials (userid, password, usertype) Customer ...
5
votes
6answers
257 views

Most efficient way to validate multiple textboxes against a tolerance value

I have a series of text boxes in a table to gather input as below: The user will input a target and actual value for each measurement point they require. I would then like to validate the actual ...
5
votes
6answers
2k views

Place Try Catch in Business Logic or User Interface

I found the following two types of handling exception in Business Logic Layer. ASP.NET 3.5 Enterprise Application Development use similar method like the first one (I read it few years ago). I also ...
5
votes
4answers
796 views

Sending GET/POST requests in .NET

I have a RequestsExtensions class with two functions for sending GET/POST requests. ...
5
votes
2answers
794 views

Optimizing a Fire and Forget page tracker

I have a bit of code that came from Egg Head Cafe a long while ago and it's been working great. But I ran the entire site through Redgate's Profiler. and it came up as the biggest hot spot in my code. ...
5
votes
1answer
1k 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 ...
5
votes
1answer
82 views

Sugestion on a better way to code this EF update?

I have a block of code that pulls the current menu position and compares it to what users selected, if the selection is different the database is updated with the new selection. As I am still new with ...
5
votes
2answers
102 views

Adding object to database, using linq or sql connection

I have a table called tblDelegates in my database which I need to populate with some data. I have created a class called Delegates which has various properties to ...
5
votes
1answer
87 views

SQL Join code check and peer review

I am still fairly green when it comes to SQL joins. The below code works but I want to check that I am doing it the best way before I copy and paste errors into other work in the future. The idea of ...
5
votes
1answer
122 views

Convert looping statement to linq mode

I have a model object class like this ...
5
votes
2answers
1k views

trying to optimize 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 ...
5
votes
1answer
175 views

optimize the pagination of repeater?

Hi I have some problem in my View.ascx.cs because I'm using reuse my code and modified it based on the situation for example I when I apply pagination I have efferent code in all place just I wan to ...
5
votes
2answers
2k views

Session Wrapper

I have two types of session wrappers: Type 1: ...
5
votes
2answers
2k 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 ...
5
votes
1answer
2k views

Web API and Stored Procedures

I am building a web service that gets data via Stored Procedures from a db and provides the result as JSON. The solution is built as a MVC 4 Web API project. I have to retrieve the data via Stored ...
4
votes
4answers
418 views

Plese review following methods

...
4
votes
9answers
3k views

Is there a better way to do this database insert? Looking for best-practice example.

I wrote the following code to insert records into a database. The user selects the rows from the RadGrid and the insert command is executed when that user clicks the button. I've been spending a lot ...
4
votes
2answers
67 views

Searching through various PDF files

I'm just looking for advice on how I can get my code to operate faster. It's pretty quick right now with searching through 30 3-page PDFs, but I imagine once there gets to be thousands of files to ...
4
votes
2answers
365 views

Can this combo box code be more compact and prettier?

I have 3 combo boxes with the same 3 selections in each. If the user picks the same selection a 2nd time, the first combo box resets. I have 3 other sections that will do the same with about 15 combo ...
4
votes
1answer
192 views

Can my code be made into one?

I've the following code: ...