asp.net

Use the routing engine for form submissions in ASP.NET MVC Preview 4

Hi, I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions. For example, I have a route like this: routes.MapRoute( "TestController-TestAction", "TestController.mvc/TestAction/{paramName}", new { controller = "TestController", action = "TestAction",...

Import Namespace System.Query

I am trying to load Linq on my .Net 3.5 enabled web server by adding the following to my .aspx page: <%@ Import Namespace="System.Query" %> However, this fails and tells me it cannot find the namespace. The type or namespace name 'Query' does not exist in the namespace 'System' I have also tried with no luck: System.Data.Linq...

Is there some way of recycling a Crystal Reports dataset?

I'm trying to write a Crystal Report which has totals grouped in a different way to the main report. The only way I've been able to do this so far is to use a subreport for the totals, but it means having to hit the data source again to retrieve the same data, which seems like nonsense. Here's a simplified example: date name ...

Best references for secure coding practices in ASP.NET and classic ASP.

What are some of the best reference material for secure coding in the ASP.NET and classic ASP environments? I'm sure there are a ton of books out there but which ones are the best for this? If anyone has pointers to online resources also, that would be appreciated. ...

Generate sitemap on the fly

Hi, I'm trying to generate a sitemap.xml on the fly for a particular asp.net website. I found a couple solutions: chinookwebs cervoproject newtonking Chinookwebs is working great but seems a bit inactive right now and it's impossible to personalize the "priority" and the "changefreq" tags of each and every page, they all inherit t...

Running Javascript after control's selected value has been set

Simple asp.net application. I have two drop down controls, on the first drop down I have a javascript onChange event. The javascript enables the second drop down and removes a value from it (the value selected in the first drop down). If they click the blank first value of the dropdown, then the second drop down will be disabled (and th...

ASP.Net Datagrid: in Footer calculate Avg or Sum for column

I have a datagrid getting bound to a dataset, and I want to display the average result in the footer for a column populated with integers. The way I figure, there's 2 ways I can think of: 1."Use the Source, Luke" In the code where I'm calling DataGrid.DataBind(), use the DataTable.Compute() method (or in my case DataSet.DataTable(0).Co...

How do I add an additional window.onload event in Javascript

In my asp.net User Control I'm adding some script to the window.onload event like so: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true); My problem is, if t...

RaisePostBackEvent not firing

I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs). The control is implemented in two different user controls. In one control, RaisePostBackEvent is fired on the server-side when __doPostBack is invoked. In the other control, RaisePostBackEvent is never invoke...

Replicating load related crashes in non-production environments

Hi all, We're running a custom application on our intranet and we have found a problem after upgrading it recently where IIS hangs with 100% CPU usage, requiring a reset. Rather than subject users to the hangs, we've rolled back to the previous release while we determine a solution. The first step is to reproduce the problem -- but we...

Sending emails without looking like spam

Possible Duplicate: How do you make sure email you send programmatically is not automatically marked as spam? Hi people, I want so send every week an update by email. But Im afraid that if there are too many emails sent, they will be marked as spam. Any of you has experience sending many emails (thousands) weekly? What techni...

Calculate DateTime Weeks into Rows

I am currently writing a small calendar in ASP.Net C#. Currently to produce the rows of the weeks I do the following for loop: var iWeeks = 6; for (int w = 0; w < iWeeks; w++) { This works fine, however, some month will only have 5 weeks and in some rare cases, 4. How can I calculate the number of rows that will be required for a par...

Best mock framework that can do both WebForms and MVC?

I'm getting into more of a TDD workflow, and have a mix of MVC and asp.net Web Forms apps. MOQ is recommended for MVC. I've used Rhino for Web Forms. Does anyone have a best practice for having 1 framework mock for both? ...

What are the useful new ASP.NET features in the .NET Framework 3.5?

I've kept up to date with new features in the C# language as it's moved from version 1 through version 3. I haven't done such a good job keeping up to date with ASP.NET. I feel like some of the post version 1 features are not so good (e.g. the AJAX framework) or are just not that useful to me (e.g. the membership framework). Can anyon...

Validating posted form data in the ASP.NET MVC framework

I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data and error messages? Also, where should the validation logi...

Creating iCal Files in c#

I'm looking for a good method of generating an iCalendar file (*.ics) in c# (asp.net). I've found a couple resources, but one thing that has been lacking is their support for quoted-printable fields - fields that have carriage returns and line feeds. For example, if the description field isn't encoded properly, only the first line will...

Does the OutputCacheFilter in the Microsoft MVC Preview 4 actually save on action invocations?

We deployed a live, fresh, swanky site using preview 3 including rigorous stress testing. Page Output caching was our saviour and afforded us the ability to meet our performance contractual requirements. My question is, is there a difference between action OutputCacheFilter and page output caching? Is the action output caching faster...

Convert an asp.net application to IIS7 integrated mode

What steps I need to perform in order to convert asp.net 2 application from IIS7 classic to integrated mode? ...

Catching unhandled exceptions in ASP.NET UserControls

I'm dynamically loading user controls adding them to the Controls collection of the web form. I'd like to hide user controls if they cause a unhandled exception while rendering. So, I tried hooking to the Error event of each UserControl but it seems that this event never fires for the UserControls as it does for Page class. Did some ...

ASP.NET Web Site or Web Project

When creating a new ASP.NET project in Visual Studio should I chose create: website or project? I understand that web application project was the way to do it back in the day with VS 2003 but is it still applicable today? What are some of the caveats using one over the other? ...