asp.net

Code reusability - App_Code or BIN or UserControls?

I recently had a discussion on another forum with another developer and the topic was Code Reuse in ASP.NET. The stated scenario was that he needs to update code frequently on Production servers during server uptimes, and this results in Session getting reset for all users. He is avoiding putting shared code or classes into the App_Code ...

Is it worth using 3-tier architecture for small(ish) applications

I'm working on a relatively small asp.net web application and am wondering if there is really a need to employ full n-tier architecture. For an idea of size; there are about 20 database tables. In the past I have used a 2-tier approach where business logic and data access are grouped together into a single class library with was an asp...

asp.net 2.0 global themes not working on new windows server 2008

We're migrating our .net 2.0 websites from a Windows 2003 server (32 bit) with IIS6 to a Windows Server 2008 (64 bit) box with IIS7. I can't seem to get the global themes to work. Same content/directory structure as our old servers; local App_Themes work fine. Global Theme path: D:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\The...

Query ManagementScope object to find out Cache size in ASP.NET

I'm wanting to programmatically monitor the cache size on a certain ASP.NET site. This is basically for the administration portion of a product, where we allow users to partially control whether their site uses caching or not. Is there a way to do this. Should I be using the ManagementScope object to perform this query? ...

Why is the boolean variable always resetting to false;

Hello, I have a boolean variable declared at the top of a class and when a radio button is selected on a page, the variable gets set to true, but when the page is reloaded, the variable gets reset back to false. One way I have handled this was by using the static keyword, but I am not sure if this is the best way to handle this. Here ...

In ASP.Net, what is the difference between <%= and <%#

In ASP.Net, what is the difference between <%= x %> and <%# x %>? ...

Disabling a checkbox in asp.net

I am dynamically creating a CheckBox and setting the disabled property like this: chk.Disabled = false. This renders the following HTML: <input type="checkbox" disabled="disabled" .../> On the click of the checkbox, I have a JS function that tries to enable it by doing a: //get reference to the checkbox chk.disabled = false; Thi...

Impersonation and Delegation in ASP.NET

I'm having problems accessing a text file on a remote server with ASP.NET. The ASP.NET 1.1 application is running on Server 2003 using Impersonation with the requester's Windows Credentials. The client, webserver, and remote server are all on the same domain, and the user has permission to access the text file. The user can open the t...

Getting project web page names as an enumeration in asp.net.

Hello everyone, I know that in markup view Visual Studio will provide you with an enumeration of all the page names in your project (add an element and see what you get from Intellisense when specifying the ImageUrl attribute). My question is: how do I get to that enumeration? If that's not possible, what would be the best way in asp....

Trying to self contain pop ups which use the AjaxToolkit ModalPopUpExtender

I have 3 different kinds of ajax popups that need to exist across my site. I was hoping that I could simply create a user control for each one and place the panel and modal popup extender inside each one but this doesn't seem to be working. Has anyone tried this before or do you have a recommendation as to how I can avoid duplicate code ...

Control.ResolveUrl versus Control.ResolveClientUrl versus VirtualPathUtility.ToAbsolute

Is there any benifit to using one of these methods over the other when resolving paths which start with the tilde (~)? Generally, what is a better practice, should you be sending relative paths or absolute paths down in your html? ...

CSRF Validation Token: session id safe?

In asp.net I am implementing an IHttpModule to mitigate CSRF attacks. It injects into the response html a hidden form parameter with the asp.net SessionID on GETs. On POSTs it then checks to make sure that hidden parameter's value matches the current SessionID. As far as I know, the only way to get the SessionID value is from the cook...

What objects should you return from the data access layer to the business layer an n-tier system

If you have, for example, a database table called Person (ID,Name etc) what kind of object should the data access tier return to the business tier? I'm thinking something like this: //data access tier public class DataAccess{ public interface IPerson{ int ID{ get; set; } string Name{ get; set; } } internal class P...

How do I control repeated Ajax 'post' submissions?

I do not want to stop the user from clicking the same ajax button many times, but I want to exercise some control to prevent someone from maliciously clicking the button repeatedly which would cause repeated database requests. What is simple way to handle this on a jquery .post in asp.net mvc? If I put in a time delay, the experience cli...

Does Dispose method still get called when Exception is thrown inside of Using statment?

In the example below, is connection going to close and dispose when exception is thrown if it is within using statement? using (var conn = new SqlConnection("...")) { conn.Open(); // stuff happens here and exception is thrown... } I know this code below will make sure that it does, but I'm curious how using statment does it. ...

Management of ASP.NET User Profiles

The Storing User Profile quickstart gives some information about managing ASP.NET user profile. In my case the administrator has to be able to change/monitor some properties with profiles. Is it posible to access and change user profile's properties in another user profile by using default SqlServerProfileProvider and how? Thanks. ...

ASP.NET set theme based on URL

I have a web app that up until now has been skinned (just basic colours and logos, nothing complicated) to a single company , however now since the merging with another company the site needs to be branded as two seperate companies (operation is exactly the same for both, and they share the same data). The simplest way would be to just c...

How can I retrieve an embedded xml resource?

I added an XML file as an embedded resource in my class library by using the accessing the project properties in Visual Studio and then Resources | Add Resource | Add Existing File... I've tried to access the file using the following code, but I keep getting a null reference returned. Anyone have any ideas? var path = Server.MapPath("~...

Know a good templated ASP.Net Calendar control?

I'm looking to find a decent calendar control for an ASP.Net application that allows each day to have an "ItemTemplate" type of declaration so that I can list things that are happening within each day. Something like the Club Starter Kit, only more robust and that can handle other datasources besides DataSets and DataTables. I'm thinkin...

File does not begin with '%PDF-'

I am exporting the HTML Content to PDF. System.IO.StringWriter sWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter); Response.Buffer = true; FormId.RenderControl(htmlWriter); Response.ContentType = "application/pdf"; // Added appropriate headers Response....