Welcome

At Creative Dreaming we build Web Applications!

From simple websites through to complete business management systems we can provide the solution to your needs. We will work with you to provide the best solution for your circumstances meeting your objectives.

Solutions that might be of interest include:

  • Static Sites
  • Content Managed Sites
  • Online Business Solutions such as Shops and Subscription Services
  • Bespoke Business System Solutions

From data management to client interaction a web application is an affordable bespoke software solution that could benefit your business. See our services page for more details.

We are active in the development community and share our knowledge and experience through our articles page.

We are located in Wellington, New Zealand and have a client base in the United Kingdom. We do of course consider work from anywhere in the world.

Browse our site, explore the options we provide and please feel very free to contact us to see how we can help you.



Featured Work

Warren Buffett Bridge Cup

GolfNetTourney - New Zealand Golf Tournament

The Property Investment Shop

The Phil Parker Lightning Process

Eft... Tapping - Rosalind Bubb

Amanzi Travel

ASP.NET

Location: BlogsComments    
Posted by: Dale Monday, January 17, 2011

ASP.NET Caching GET/POST. ASP.NET provides some very good tools for caching, but its an area that is often misunderstood and often not taken advantage of. For a recent site I wanted most pages cached, at least on the GET request. However certain controls, namely a search box, appeared on every page and needed to be processed properly by the server. Turning caching on at all locations didn't do the job because while the client will always request a POST request, the server at best would cache the page based on the form fields. That was until I discovered Response.Cache.AddValidationCallback (http://msdn.microsoft.com/en-us/library/a5e5hdyz(v=VS.85).aspx) which allows you to add some logic of your choice to the determination as to whether a page is in the cache or not. A simple check of Request.HttpMethod == "POST" allowed me to ignore all cached pages on POST and make full use of the cache on GET.

Enhanced Validators. I had a recent need to change the input & label style on validation. This isn't possible out of the box with asp.net validators, but lucky for me someone had already done the hard work.Check out Enhanced Validation by Ronald Partridge. It worked pretty much out of the box, but as I had a couple of extra requirements I ended up having to modify the code (see my comment at the bottom). I also added a checkbox validator and a textbox length validator. Happy to supply code as is - just contact me.

Using FormView always renders with a table. There are some ways to override the rendering method of ASP.NET controls but they do introduce additional complexity. I found the easiest solution to remove the tables was to use a repeater control and only display 1 record. It doesn't do everything that the FormView does but it does quite a bit. Update: The latest version of .NET provides far more control over rendering. Or there is the CSSFriendly adaptor.

Minimise binding with ASP.NET controls. In the past I've often found myself databinding using a datasource control to say a repeater control and then having to do a manual query on the database to obtain say the page title or similar. Then I realised that you can bind the field as <%#BindMore((String)Eval("Field1"), (String)Eval("Field2")%> inside the databound control and then in BindMore save the values for use later in say PreRender, saving a trip to the database.

Using Session State in HttpHandlers e.g. WebHandlers is ASHX files. Remember to implement IReadOnlySessionState.

<% @ webhandler language="C#" class="DownloadHandler" %>using System;
using System.Web;
using System.Web.SessionState;

public class MyHandler : IHttpHandler, IReadOnlySessionState
{
public bool IsReusable { get { return true; } }

public void ProcessRequest(HttpContext Context)
{
Context.Response.Write(Context.Session["fred"]);
}
}


Thanks to Scott Hanselman

Data Formatting ASP.NET 2.0 Gridview: I recently had a problem formatting data in a Gridview and found (thanks to this article: http://weblogs.asp.net/rajbk/archive/2005/10/31/429090.aspx) that because formatting occurs after the HTML encode function (which is on by default) the formatting has no effect. Setting HtmlEncoding to 'false' solves the problem.

Error "Cannot use a leading .. to exit above the top directory.": This may happen when re-writing URL's in which case for the solution see this thread: DNN Forum Post and this blog: ToDotNet Blog Post

Error " Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. ": If you are sure that the error is not caused by the points mentioned then check this DotNetSlackers Blog Post and this ASP.NET Forums Post

Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(...) Error received when adding a new user to an asp.net membership application. This is due to using "encryption' and not having an available machine key. You can create a machine key here: Machine Key Creator

Permalink |  Trackback

Your name:
Title:
Comment:
Add Comment   Cancel