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

-2
votes
0answers
28 views

This one time, I called a constructor and got a null reference exception [closed]

This is the whole pasted version of a particular page load I have on some page somewhere. Extra detail: ServerData is a class with an overloaded [] which brings back a list of interfaces based on ...
2
votes
1answer
72 views

Why is loading images taking so long?

When Page_Load is executed I assign the ImageUrl which is a IHTTPHandler: ...
2
votes
1answer
63 views

Null checks in view

It's really a nitty-gritty issue for me, and I have been here many times before. How could this be improved? I have a basic viewmodel for a view: ...
3
votes
3answers
487 views

Code optimzation by constant if-structure iteration removal

Below you will find the specific code that I am attempting to optimize. I have a method previous to called getCount() which, based on similar parameters as below, ...
-1
votes
1answer
66 views

When a radio button is clicked, disable some search fields

The table has 4 search types and 4 radio buttons; when one radio button is clicked, other fields should be disabled. The JavaScript code seems repetitive. How can I improve it? JavaScript ...
0
votes
1answer
28 views

Binding controls to properties in ASP.Net WebForms

In my application, we have a number of pages which provide an advanced search capability, with a large number of potential search options (some pages have as few as 3, some as many as 150). The HTML ...
4
votes
2answers
49 views

Formatting checks against a session

This is the current code that gets put into a option box, is there a way to make this code more efficient and use less code ...
5
votes
1answer
84 views

Function to run MySQL SELECT queries with no leaks

I am upgrading an old massive website that is a Classic ASP \ ASP.NET hybrid. I still have a long way to MVC. Right now I want to convert all code that uses ODBC to the mysql connector specific code. ...
4
votes
1answer
72 views

WebAPI controller

It return an object with WebAPI by proving some data. Is this a good approach? ...
4
votes
1answer
57 views

Displaying a row of buttons

There must be a better way to display this code. Does anyone have any ideas? What the code does is displays a row of buttons and when you click on a button it changes the session so you can see if ...
1
vote
1answer
63 views

Make a “Web-Proxy” - step-by-step

My problem with links is solved. Text challenge is to copy pictures on remote page to my own host, then replace the links in source code. Any idea? I started creating a web proxy. I decided to ...
3
votes
1answer
69 views

Portfolio website

I'm making a portfolio website right now with Visual Studio 2013 and ASP.NET 3.5 because my free hosting only supports 3.5. Are there any bad practices in my code at the moment? What would you change ...
2
votes
2answers
159 views

Method for getting the DataTable when having connection ID and the SQL command

I am quite new to C# and to the ASP.NET programming. When maintaining the legacy code, I have found rather terrible implementation of the method that is used on many places to get the ...
1
vote
0answers
49 views

Wrapping a GridView with custom controls

My aim is to create a server control which inherits from a GridView and outputs the basic output wrapped in external markup, including other controls. For example, the output will look something ...
3
votes
2answers
72 views

Better way to group elements?

this.Items is a list of products. Each product has a category (product.Attributes["category"]). I want to render a drop down ...
2
votes
1answer
70 views

Admin class for monitoring blog users

I have an admin class that controls when a user logs in and creates a new blog post. I am wondering if there is anything I can do to improve this class. Is there any way to reduce the code? Is there ...
0
votes
1answer
99 views

Simple Dal for Accessing Procedures

How could I improve this code? ...
1
vote
1answer
75 views

Model binding with a ViewModel

I have two ViewModels with the one referencing the other: ...
0
votes
1answer
79 views

Handle concurrent HTTP requests with a generic .ashx

I have created a .ashx file that is able to handle concurrent http requests. Works great, but now I'd like to create a base class that does the common work in order to not repeat myself each time I ...
4
votes
3answers
247 views

Parsing dates from a webpage

I have two inputs (TextBox) on my front end. The following code parses them from their string representation to aDateTime object. If it fails, it then sets ...
3
votes
2answers
213 views

Abstract session value manager

I've been working in C# for a while, but I'm just recently starting to force myself to use better abstracted and generic code. I recently encountered a situation where I was juggling a lot of session ...
6
votes
5answers
418 views

Calling many web services asynchronously

I need to process a bunch of completed orders (thousands). To make it faster, I'm using a SemaphoreSlim to schedule a number of orders to be processed in parallel. ...
6
votes
2answers
270 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: ...
2
votes
2answers
150 views

Is there any disadvantage of using MVC Razor Syntax codes inside a NoScript tag?

I'm creating a ASP.NET MVC Website that display blogs from the database by AJAX. The problem is - I have limit the results to only 10 by default and add a Load More button to display 10 more results ...
2
votes
1answer
58 views

Redirect browser

I've got a 'menu' within a Master page which include a number of image buttons with click events. Within each click event, I want to redirect the user to a specific page. However, if the user is ...
4
votes
1answer
127 views

Filling a table in code behind

I was wondering if there could be an easier or simpler way of filling a table with code behind. So far I have my html/asp.net table : ...
3
votes
1answer
135 views

Updating Related Data the MVC/EF Way

I have an ASP.NET MVC Controller, the relevant parts of which appear here: ...
2
votes
2answers
184 views

Different Approach to the following ASP.NET Web API Action

Maybe someone here can help me sort out this implementation and make it better. First the following constraints: 1 Controller & Action that accepts all post requests, these post requests will ...
2
votes
2answers
123 views

DataTable to given type T simple mapper

I threw this together and would love any suggestions on how to improve on this simple DataTable to given Type T mapper. Anything ...
3
votes
1answer
116 views

Is this a sensible way to throttle duplicate requests in a HttpModule?

I'm writing a method to throttle duplicate requests taking place within multiple HttpModule instances within a web application. Currently I have the following ...
5
votes
2answers
974 views

Set default value for NULL in datatable

I have the following codes, which I created as extension for datatable in my project. It actually worked. Just wonder if there is any optimization can be made through. Thanks. =) ...
2
votes
1answer
75 views

Long list of SQL parameters and audits

Say I have the following code. What are your thoughts on questions 1-4 below? I think it's way too long when I have to list out most of the fields. Is there any better way of doing this? I build up ...
3
votes
1answer
130 views

TextBox rendered as Label

I have created a custom web server control that will have a bool property 'RenderAsLabel' so that I can convert TextBoxes to Labels, for read-only forms. I was wondering if there is any reason why ...
4
votes
2answers
132 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 ...
1
vote
0answers
178 views

HttpRuntime.Cache cache manager class

I am making code review of legacy class, which manages caching logic. Caching logic uses ASP.NET webforms HttpRuntime.Cache. I know class, that is posted below, is ...
5
votes
1answer
94 views

Better approach to online builder

I have a windows forms application which needs customized dll files to be built and for that I am using an online builder using asp.net. I am in no way a asp.net expert not even near a beginner but ...
6
votes
5answers
1k views

Username, Password and UserType Validation

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

Is my ObjectCache wrapper sound?

Wrapper: ...
5
votes
0answers
346 views

Unit of Work + Repository Pattern + Stored Procedures [closed]

I'm a beginner with ASP.NET Web API and the Unit of work + Repository design patterns. I've been reading a lot about ASP.NET Web API and I'm learning as much as I can so I can create a good web API. ...
3
votes
1answer
190 views

Schedule Global Task by using static System.Timers

I'm using System.Timers to schedule tasks. I find this working, but I'm not quite sure if it's ok to do it this way. ...
5
votes
2answers
355 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 ...
2
votes
2answers
119 views

Async operations in WebMethod

How can I improve this code, without to return async Task? ...
1
vote
1answer
390 views

Multi threading in ASP.Net to increase performance of processing data from entity framework using anonymous types

Intro I am trying to populate a Multi-column Combo-box with a large amount of records.Depending on the selection the user has taken there can be 1 - 50000 items in the Combo-box (I may not display ...
3
votes
3answers
107 views

Simplify ASP.Net StreamWriter for appendtext to file

Is there anyway to simplify this code so there aren't so many redundant w = File.AppendText(filePath) and w.flush() and ...
4
votes
1answer
364 views

Should I split code into smaller functions? Advice on layout

I have the following code. I was wondering if anyone can give me any pointers on how to make this more concise and neater? Should I be splitting this down into smaller functions? ...
2
votes
1answer
141 views

Web service - getting data from SQL and adding to Object

I have created a class called CommandMessages ...
6
votes
2answers
394 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
2answers
1k 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 ...
4
votes
2answers
393 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 ...
5
votes
4answers
9k views

Sending GET/POST requests in .NET

I have a RequestsExtensions class with two functions for sending GET/POST requests. ...