ASP.NET 4.0 web application always returns 404 error in IIS6

by Christoph Herold 25. July 2010 23:26

Today, I had a Windows Server 2003 system, on which I freshly installed .NET 4.0 and wanted to deploy an ASP.NET 4.0 application in it. Sounds simple enough, but everytime I tried to access the application, I got a 404 error. In my case, I had an MVC2 application, for which I also enabled the wildcard mapping (I know, it's not required with 4.0, but I did it anyways, just in case). When it was enabled, I got 404s for every request. When I took it out, at least a simple text file was delivered instead of a 404 error.

Well, the solution was very simple, but it took a while to find. The ASP.NET 4.0 web service extension was disabled. So, if you keep getting 404s for your ASP.NET application, check in the Webservice Extensions folder in the IIS Manager if the ASP.NET 4.0 extension is enabled.

Tags: , , , ,

Administration

jQuery UI DotNetNuke integration

by Christoph Herold 3. April 2009 12:04

I just launched a new project at codeplex aiming at the integration of jQuery UI in DotNetNuke: http://jquidnn.codeplex.com/. The first releases are already available in form of DNN module packages containing the core functionality, including infrastructural code to include jQuery and jQuery UI, two web controls for the Tabs and Datepicker widgets, and the smoothness theme.

Also available are module packages for three more themes: Cupertino, UI Darkness and UI Lightness. Further skins are actually quite easy to package and will follow over time, or when someone issues a request for one ;-)

So please, start grabbing the releases and giving me feedback.

Tags: , , , ,

Development

Bogus errors from ASP.NET compiler

by Christoph Herold 18. March 2009 17:43

I just wasted another hour, trying to figure out, what exactly ASP.NET was trying to tell me, when giving me an "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)." message on compiling my ascx file.

Ok, so I used a custom namespace, but I've done that hundreds of times, so that shouldn't be the problem. I also had a custom base class inheriting from UserControl. Also, nothing I haven't done before. So what was the issue now?!

I basically retyped everything concerning the namespace and class names in all files, but nothing helped. So I reverted to commenting out my code. This helped me find the issue: I used a

<% if (somethingOrOther) { %> Some code here <% } %>

construct in my ascx-file (Please don't start an argument on whether this is good practice or not. I know it's not the cleanest way to do things, but that is not the concern here :-) ), and actually forgot to put in the closing <% } %>. Ok, my fault, but shouldn't you get a better Compiler message than "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)."?!

So, if you encouter this error (and believe me, I've had it more than once due to typos), and are 100% positive you've spelled everything correctly, check for unbalanced parentheses!

Tags: , , , ,

Development

Be careful when reusing ListItems

by Christoph Herold 17. March 2009 12:12

Yesterday, I had one of those WTF moments. I had a page with a form for entering two addresses. Both had the same fields, including a RadioButtonList with identical items. Since the items are resourced, I decided to optimize the performance by reusing the ListItems like so:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation.Items.AddRange(items);
this.salutation2.Items.AddRange(items);

Simple eh. Everything seems to be ok. And was I amazed, when I tested it, and I always got the SelectedItem to be the one selected in salutation2. I double-checked every location were I was storing the values, in case I forgot to change the field name after copy/pasting. But everything was correct, as far as I could tell. I even checked the values submitted by the browser, they were also correct.

Finally, it hit me: The ListItem has a Selected property, and it is used to find the RadioButtonLists SelectedItem property. And since I reused the items, the first list parses its items on postback, sets the appropriate ListItem's Selected property to true. Same thing happens with the second RadioButtonList. And since the ListItems are used in both lists, the last one wins.

So, I changed my code to look like this:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation.Items.AddRange(items);
items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
this.salutation2.Items.AddRange(items);

Now everything works as it should. So next time, be careful when reusing your ListItems!

Tags: , , ,

Development

DotNetNuke now with jQuery

by Christoph Herold 7. January 2009 11:06

I have been using jQuery with DotNetNuke for a while now, and was very happy to finally see it integrated into DotNetNuke. What makes me wonder, is that there is no central method for including it in DNN 4.9.1. The library has been placed into the folder ~/Resources/Shared/scripts/jquery, but the one usage I could find does not use the ClientScriptManager to include the script. Instead, it manually creates a Literal script control. This will cause the script to be included multiple times, if different controls use it simultaneously. Perhaps this will be "fixed" in a future release. Perhaps adding a method to the ClientAPI for including it would be a good solution for a global include mechanism.

Tags: , , , ,

Development

Outlook 2007 stationeries and image spacing

by Christoph Herold 14. December 2008 23:50

Today, I had to make a template for a mailing. I decided to create it as a stationery for Outlook, since this was the desired way of sending the mails. Not much to it, one might think. I created the HTML for the template (of course using the dreaded layout tables, since OL2007 went back to the stone age with its rendering engine), and copied it and the required images to the stationery folder. Having done that, the stationery showed in my list and I was able to create a mail using the template.

But what's this?! Were do the gaps in between the images come from?! And why are my shadows not aligned anymore?! Outlook simply went on and pratically destroyed my layout. I basically tried everything that came to my mind, trying to fix the gaps: modified paddings and margins using css, html attributes, added fixed widths and heights, nothing seemed to work. I even removed all the tables and simply placed two images after one another, no white space in between. Still, I got my gaps.

When everything seemed hopeless, I decided to simply send the mail the way it was. Guess what: everything is in perfect shape, when the mail arrives. No gaps, everything is aligned perfectly. I can even simply forward this mail, and it looks great in the editor. So the gaps only show, when you first create the mail using the stationery. Afterwards, everything is as it should be.

<rant>Now that's what I call a consistent user experience! Great job from the folks at Microsoft. I wasted a whole day trying to work around this bug.</rant>

And by the way, using stationery is probably not the best solution, since Outlook completely reformats your code and places all those unneccessary MSO* css styles in your mail's code. So if something goes wrong with your mail, you might consider NOT using Outlook to send it in the first place.

Tags: , , ,

Design

New FCKEditorProvider for DotNetNuke

by Christoph Herold 11. August 2008 16:18

A newer (beta) version of the FCKEditorProvider for DotNetNuke has been made available: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/127/threadid/247501/scope/posts/Default.aspx

It finally integrates the newest version of FCKeditor, giving you much better styling support and various other features. So far, my tests have been quite positive with the new version.

One thing to note is the bothering "Red title" style, that is configured by default. If you wish to remove it, you can edit the fckconfig.js files located in the provider's "FCKeditor" and "Custom" folders. Just comment out the line that add the style to FCKeditor's custom styles, and you'll be rid of it.

Regards to Mauricio Márquez for his great work on the integration!

Tags: , , ,

Administration

Outlook 2007 HTML-Mail Guidance

by Christoph Herold 25. July 2007 11:12

Microsoft changed the rendering engine in Outlook 2007 to Word's HTML-engine, and it really sucks concerning modern design habits (css-positioning, etc.). So you have to look out for some pitfalls. I found a nice guide for designing HTML-Mails for use in Outlook 2007, which can be found at http://www.duoconsulting.com/downloads/contribute/SevenDesignTipsforOutlook2007.pdf.

Also, Microsoft offers tools to validate HTML files for the Word rendering engine. These can be found at http://www.microsoft.com/downloads/details.aspx?familyid=0b764c08-0f86-431e-8bd5-ef0e9ce26a3a.

So, good luck with your e-mail marketing ;-)

Tags: ,

Development | Design

Connecting to a SqlExpress User Instance

by Christoph Herold 25. April 2007 16:41

If you've ever built an ASP.NET application using a User Instance database, you may have come across the problem, that you would have liked to access the database using the Management Studio or similar programs, but just couldn't find the database, because it is in the user instance and not in the database server itself.

I'd like to issue my thanks to Mike of the Sql Server Express Weblog for publishing how it's done. I looked for hours trying to get the database attached to the regular server, but all that is not neccessary. You can directly connect to the user instance by using a named pipe. The original explanation can be found here: http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx. Below are the required steps in short.

  • Connect to the server normally.
  • Issue a new query:
    SELECT owning_principal_name, instance_pipe_name, heart_beat FROM sys.dm_os_child_instances
  • Locate the user instance you wish to connect to and copy the instance_pipe_name column's value.
  • Open a new server connection and use the copied value as the server name.

And presto, you can access everything as you would in the regular server.

Note: The pipe name is generated, when the user instance is first created. After that, it will always remain the same, so you can store it for later use. Access is only possible, when the user instance is active (see the heart_beat column). If it is not, you must first launch the application that uses it (i.e. the web site).

Tags: ,

Development | Administration

PersistenceMode.InnerDefaultProperty

by Christoph Herold 21. December 2006 11:34

While I was building an ASP.NET user control, I ran across the problem, how to serialize a property as the inner text of the Control in the ASPX-Code. I found a nice attribute named PersistenceModeAttribute, that allows you to specify, how a property is supposed to be persisted. Setting it to InnerDefaultProperty or EncodedInnerDefaultProperty should do the trick, I thought.

But, as I had to find out, this is only part of what needs to be done. There are two more Attributes, that control the parsing of a control: ParseChildrenAttribute and PersistChildrenAttribute. When you use InnerDefaultProperty to persist a property, you must add [ParseChildren(true, "")] and [PersistChildren(false)] to your control's class declaration. Otherwise things won't persist.

It took me a while to find this solution, and I found a nice explanation of things here: http://alvinzc.blogspot.com/2006/10/aspnet-basic-of-custom-server-control_25.html.

Alvin did a really nice job of explaining, what the attributes do. So if you want the details, just visit his blog.

Tags: , ,

Development

Month List

Impressum (for the Germans)

Christoph Herold

Dieses Weblog wird bereitgestellt und verwaltet durch

Christoph Herold
Ignaz-Semmelweis-Str. 37
41540 Dormagen
Deutschland

Sie erreichen mich unter christoph.herold@coeamyd.net.