asp.net

Why does the Update Panel deselect the current selection in a listbox when selecting another?

I have a asp:ListBox wrapped inside an asp:UpdatePanel. The list box contains all the United States. If I select Alaska, for example, and then scroll down to select Wyoming, the listbox jumps back up to the top of the list instead of staying on Wyoming and it deselects Alaska, but Wyoming remains selected. Has anyone ran into this bef...

OOP design question - keeping track of many similar things

I'm designing a Data Access layer for an C#/ASP.net application and I have a question regarding the treatment of parameters in sql queries. At the moment, when a query needs a dynamically set parameter for the Where clause I have to (1) define a variable to hold the value, (2) add a new QueryStringParameter to the SqlDataSource's Select...

Exception of type 'System.OutOfMemoryException' was thrown. Why?

I have a dynamic query that returns around 590,000 records. It runs successfully the first time, but if I run it again, I keep getting a System.OutOfMemoryException. What are some reasons this could be happening? The error is happening here: public static DataSet GetDataSet(string databaseName,string ...

Random "virtualPath" error - Asp.Net application

The full error is - "Value cannot be null. Parameter name: virtualPath". This is occurring in our QA and Training environments (Win 2003 Server & IIS6) but of course defies recreation in a debugger. To make matters worse, despite a reasonable global error handler, no stack trace accompanies the error and nothing is written to the event l...

Obfuscating a .NET Web application

Hi, Is it possible to obfuscate a .NET web application? I tried to use the Dotofuscator tool that comes with Visual Studio 2005 and I was able to obfuscate the dlls of a precompiled web site, but when I deployed the soultion to an IIS server, I could not the pages of the application. So the question would be: was any of you able to obf...

Creating HTMLControls versus outputting a string of HTML

I was recently trying to explain to a programmer why, in ASP.Net, they should create HTMLControls instead of creating HTML strings to create Web pages. I know it is a better way of doing things, but I really couldn't give concrete reasons, other than, "This way is better." If you had to answer this question, what would your answer be? ...

Dynamically refreshing rows in an HTML table using an UpdatePanel

I have been using the ASP.NET AJAX UpdatePanel control a lot lately for some intranet apps I've been working on, and for the most part, I have been using it to dynamically refresh data or hide and show controls on a form based on the user's actions. There is one place where I have been having a bit of trouble, and I'm wondering if anyon...

How to use multiple view engines in ASP.NET MVC application

Hi, I'd like to use two view engines in my asp.net mvc web application. The first one is the Brail view engine from MVCContrib project, and another one is my custom view engine for generating javascript code. However, I can't configure the application to use both engines. I'd like to use view file extension to discern which engine should...

Asp.net duplicate form submissions on reload

How do I prevent a form that is posted a second time because of a page reload in a browser from being added to my database again with C# Asp.Net. Thanks, Steven ...

Memory Mapped Files .NET

I have a project and it needs to access a large amount of proprietary data in ASP.NET. This was done on the Linux/PHP by loading the data in shared memory. I was wondering if trying to use Memory Mapped Files would be the way to go, or if there is a better way with better .NET support. I was thinking of using the Data Cache but not su...

.net 3.5, does it need your computer to be restarted for it to work?

Hey gang, I need to know if i need to restart my computer to get .net 3.5 to work with my web applications after i install it. My server machine is using IIS. On my local machine the web app works fine. When i browse to it on the server, i'm seeing errors like the Linq assemblies can't be found ... even though the references are in the ...

ASP.NET/C# - Detect File Size from Other Server?

I'm trying to find the file size of a file on a server. The following code I got from this guy accomplishes that for your own server: string MyFile = "~/photos/mymug.gif"; FileInfo finfo = new FileInfo(Server.MapPath(MyFile)); long FileInBytes = finfo.Length; long FileInKB = finfo.Length / 1024; Response.Write("File Size: " + FileInBy...

Binding DropDownList DataSource to an XPathSelect

Greetings! I have some XML like this: <Root> <MainSection> <SomeNode>Some Node Value</SomeNode> <SomeOtherNode>Some Other Node Value</SomeOtherNode> <Areas> <Area someattribute="aaa" name="Alpha" value="0" /> <Area someattribute="bbb" name="Beta" value="1" /> <Area someatt...

Import error in a inline .aspx page

Hi, I have a import directive in my inline .aspx page (no code-behind). <%@ Import namespace="Microsoft.SqlServer.Dts.Runtime" %> Getting an error: The type or namespace name 'Dts' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?) What is the issue? Do I need a /bin directory with the .dl...

Bypass IE "The webpage you are viewing..." pop up

Is there a way to bypass the following IE popup box: The webapge you are viewing is trying to close the window. Do you want to close this window? Yes|No This is occurring when I add window.close() to the onclick event of an asp.net button control ...

Can I Add ConnectionStrings to the ConnectionStringCollection at Runtime?

Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application? I have tried the following but am told that the configuration file is readonly. ConfigurationManager.ConnectionStrings.Add(new ConnectionStringSettings(params)); Is there anot...

.NET - How to build themes for big CSS files

I am in charge of providing a theme functionality for a site using a big CSS file (thousands of elements) I've just inherited. Basically we want to allow the user to be able to change the colors on the screen. Every CSS element, besides color definition also have lots of other attributes - size, font, float, etc... As well a specific co...

Output Caching - GetVaryByCustomString based on value set in PageLoad()

I am using ASP.net Output Caching and want to implement GetVaryByCustomString () version of it. However I've gotten into a problem when the cache is based on a value set in the PageLoad() of a page. When Default.aspx load, the version of the USER CONTROL I would like to show is based on the URL which needs to go through a database query...

ASP.NET CSS Adapters without the crazy js injected to "help you"

Hi, the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit. I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that lets me click on nodes and ...

ASP.NET MVC controller unit testing boggle

I've been going through the various tutorials regarding the right way to unit test controller logic. Take the following action: public ActionResult Login() { //Return the index view if we're still here return View(); } Word on the street is to wire up a test method similar to this: [TestMethod] pub...