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

4
votes
1answer
38 views

Using static management class to control db transactions through an EF6

I have the class below to manage my specific implementation of a membership system using entity framework 6.1 Is the use of static access correct in this case? as far as I understood that EF context ...
0
votes
0answers
23 views

Converting JSON properties to numbers when serializing using Json.net and C# [closed]

I want to output the following example data in JSON: {"source_id":"1234","contacts":["15":"020 8111 1111"]} I've tried using the following code to achieve this using Json.net: ...
3
votes
1answer
37 views

Horrible nested if statement for changing CSS based on RadioButton selection

I'm writing away for this website, and I've come into a problem. I need to display only one td based on the corresponding radio button pressed. However, there are ...
4
votes
2answers
55 views

Server side validations and unit testing in MVP

We are following passive controller approach and when user clicks on submit, server side validations are fired. There are many other fields on the screen that needs to be validated. I would like to ...
3
votes
0answers
11 views

Stored Procedure variable column update

The purpose of the below code is to update a column based on the name of the field name sent from the .NET code. This allows one piece of code to handle multiple rows when a user is only ...
1
vote
2answers
70 views

Is this use of Newtonsoft.Json.JsonConvert.SerializeObject secure?

Like many ASP.NET developers, I use the Newtonsoft library to convert C# objects into JSON. Is this use of Newtonsoft.Json.JsonConvert.SerializeObject secure? Here ...
3
votes
2answers
82 views

Using properties efficiently in inheritance

I have a class called Mailer which has some properties like this ...
1
vote
0answers
61 views

Generic Repository, UnitOfWork and IOC container

I am stuck to define a generic repository with AutoFac IOC container. I am keeping thing very simple and only showing relevent information. I have a BaseEntity ...
6
votes
1answer
39 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
3answers
103 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 ...
2
votes
0answers
35 views

Tracking sports statistics

I am designing a new application to track sports statistics. I am using code first migration. I have the bare minimum POCO setup. The problem is I am not happy with the design specifically how the ...
0
votes
0answers
24 views

Adding viewstate based property and implication in future converstion to mvc in asp.net forms project

Suppostedly adding another viewstate based property in user control (riddled with similar properties) incur technical debt in future effort to convert projects to MVC (comment made by one of my ...
6
votes
2answers
156 views
3
votes
2answers
139 views

Where to databind a GridView?

Something that bothers me a lot when coding is best practice. I am completely self taught and I find it difficult to know whether I am doing things in the 'right way'. Let's say I have a Gridview on ...
3
votes
3answers
127 views

Cleaning if-statements in job applicant email system

I just wrote this and don't like how bulky it is, also given the fact I will have to add at least another if statement. I was going to switch it to a case ...
1
vote
1answer
25 views

Excel to SQL Upload

Aim: Import Excel to SQL Potential Issue: Wrong file type - this is handled in the 'upload' button by not allowing anything but *.xlsx files The wrong type of Excel file i.e. not 2003 onwards, ...
1
vote
0answers
367 views

Code First/Database First Entity Framework MVC [closed]

The following example is taken from the book Pro ASP.NET MVC 4 - Adam Freeman. This book does a good job going over the basics of the MVC framework. In it a ...
4
votes
1answer
103 views

Convert looping statement to linq mode

I have a model object class like this ...
5
votes
1answer
135 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 ...
4
votes
2answers
395 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 ...
4
votes
1answer
561 views

Entity Framework, code-first repository pattern review. Where to validate?

I've been iterating on my repository pattern implementation over the course of the past 4-5 months. In my new projects I choose to use this pattern and I try to improve upon what I learned in previous ...
0
votes
0answers
246 views

SignalR Chat + Navbar Implementation

I've been trying to ramp on SignalR. Here's the goal: Navbar connections to support navbar notifications like "someone poked you" Chat connections for when users are in the Chat page multi-tenant ...
4
votes
1answer
390 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 ...
3
votes
1answer
197 views

Is this password hashing acceptable for a custom MembershipProvider?

I'm creating a custom MembershipProvider for an ASP.NET MVC5 application and am wanting to know if this code is acceptable for creating hashed and salted passwords. ...
4
votes
1answer
71 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 ...
1
vote
1answer
128 views

Avoiding Duplicate Boilerplate Code in WCF Service

I'm responsible for maintaining a web service project in c#. I have one service class with a bunch of methods that look a lot like this: ...
4
votes
1answer
344 views

Implementing SOLID Principles with C# Asp.net

I have started learning about SOLID principles from yesterday. I've got a detailed explanation of SOLID principle here. After reading it and few other articles, I have tried to apply these principles ...
3
votes
3answers
129 views

How to make my code faster and easier?

This is my .cs part code where I am calling storeprocedure in LINQ to SQL: ...
3
votes
1answer
65 views

Retrieving statistics about URL clicks

I'm pretty new to ASP/MVC but have had some prior programming experience. I am trying to retrieve statistics about URL clicks - total clicks and unique clicks by IP address. I started with: ...
3
votes
2answers
80 views

3 layer design and multiple dataset

I'm new to C# and OO programing. I have an aspx page with 3 lists of checkboxes and I would like to generate them from the DB. how should I structure my code? Here is an example of what I did so far: ...
2
votes
2answers
120 views

Sharing domain between ASP.NET and self running application

I'm building pretty big application and i wonder how should i share the code between asp.net mvc website and standalone (self running) server application. I've got some idea how should i do this but ...
1
vote
1answer
343 views

How to efficiently extract Key Value and load to C# dictionary/HashMap from large files [File Size grows]?

Please review the code and suggest better algorithm to efficiently extract key/value from files using multithread. Input : FormNGFAddTab:First add Tab control inside Tabs control.परीक्षण Output : ...
1
vote
1answer
76 views

Separating presentation/BLL/DAL

I'm new to ASP.Net and up until now my code has worked but has been a mish mash all over the place with no real structure. I'm trying to teach myself how to keep the presentation/BLL/DAL separate so I ...
5
votes
6answers
225 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 ...
1
vote
2answers
85 views

Please compare these methods of accessing web forms controls using unobtrusive javascript

It's a common scenario. You have an ASP.NET web form with all of its controls (and generated IDs), and you have a separate Javascript file that needs to use those controls. What's the best practice? ...
6
votes
2answers
463 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 ...
2
votes
3answers
492 views

Generating and sending new password to user

Generate new password and send to user, if user is registered. Two TextBox on page, txtUserName & ...
2
votes
1answer
145 views

Check if Item exists in Grid using Linq

I have a grid which allows a user to enter a new Grid item. If the grid item exists or the tb is empty it displays the error. Here's the code I came up with. Can ...
1
vote
1answer
100 views

Using static methods? [closed]

I am working on a ASP.NET web application and there was recently a need to dynamically generate columns. I created a static class ColumnBuilder.cs, which takes in ...
1
vote
2answers
110 views

simple transaction process

I ask if the following code need some refactoring : ...
3
votes
0answers
190 views

Acceptable Way to Navigate in ASP.NET MVC 4 in SPA-like App

I'm getting back into web development, and I'm creating a mobile-friendly web app. I'm trying to make it SPA-like in the sense that I don't load new pages for each action the user takes. As my ...
0
votes
1answer
40 views

Generalising the data binding operation

Can i create a method to do workks of these five section? I'm doing binding operation so many times. Have an idea to make these code more pretty? ddlModelValue -> asp.net DropDownList ...
2
votes
1answer
927 views

When to use 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 DBContext. Currently, I have a separate ...
1
vote
0answers
111 views

Wrapping postback functions to call custom code at execution

Here is my solution for this stackoverflow question. It is designed to return an onbeforeunload message when the user leaves the page (excluding postbacks). It ...
2
votes
1answer
247 views

Extract data from one column of SQL Server table

I have an SQL Server table from which I want to extract data from one column (DD) and return as multiple columns. The data is in ...
3
votes
1answer
310 views

Multiple Ajax Requests per MVC 4 View

I'm using the repository pattern with a context and ninject as the IOC. I have a service which handles getting and setting page properties in the database. ...
5
votes
1answer
151 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 ...
2
votes
2answers
1k views

Interface programming with Data Access Layer

I have several controls that are bound from database tables. Putting my OOP thinking cap on I figured since all of the controls will have a SqlCommand name and an ...
4
votes
1answer
85 views

In need of some aid in regards to making my code more efficient

I've created a form that gathers and submits information to SQL database via LINQ, and sends an email if all goes while saving the database and doing a redirect. Recently, it started submitting data ...
0
votes
1answer
67 views

Searching for a better implementation to EnumBase

In a former question on SO I described a problem with a construct called 'EnumBase'. As I sad there, I am not involved when basic implementation happened. So I'm not sure why the thinks are a they ...