ASP.NET Membership – Show list of users online

by Arnold Matusz 13 7 2009

The .NET Framework 2.0+ comes with a set of functionality for easily building security enforced web applications mainly with the ASP.NET Membership API and the Security web controls. The Membership class has most of the feature one would need with user management, and because it is based on a Provider Model you can write a provider for any Database you wish.

While working on an intranet application I often faced the following situation. Several people were online, logged in, when I needed to upload a new version of the web application. Because I personally know all the people who have access to this application it’s important for me to see who is online so I can announce them before taking the application down and uploading a new version. » Continue reading ...

jQuery and ASP.NET first steps

by Arnold Matusz 26 4 2009

This post may be most relevant to those who haven’t had the chance to work with jQuery yet. Lately there is a great hype around jQuery, very many people talk about it, very many write excellent example but most of them target more advanced users.

jQuery is a lightweight (~19KB Minified and Gzipped) JavaScript library which easily enables us to traverse the DOM (Document Object Model), handle events, animate elements, and do asynchronous requests (AJAX – Asynchronous JavaScript and XML). » Continue reading ...

jQuery live() and ASP.NET Ajax asynchronous postback

by Arnold Matusz 25 3 2009

In my last post I blogged about how jQuery $(document).ready() and ASP.NET Ajax asynchronous postbacks can be made to behave well together. The issue is that normally $(document).ready() is called when the DOM is ready to be manipulated. But this doens’t happen after an ASP.NET Ajax asynch postback occurs.

This means that the initial jQuery bindings won’t be automatically available after the asynchronous postback is over. I underline “automatically” here because my last post describes more possibilities, how this issue can be worked around. » Continue reading ...

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

by Arnold Matusz 24 2 2009

I’ve been a bit skeptic about the thought of combining ASP.NET Ajax with jQuery, partly because I didn’t really know what the impact was going to be. But jQuery is very fast, very appreciated throughout general opinion, there are extremely many plugins available for free, writing your own plugins only requires little JavaScript knowledge (opposed to writing your own extender in .NET, like controls in the AjaxControlToolkit).

To be sincere, there is a very short learning curve so there is no reason for not trying jQuery. I’ve tried with regular web applications, but when I coupled jQuery with ASP.NET Ajax on little niggle stood out. » Continue reading ...

ModalPopupExtender to show a MessageBox

by Arnold Matusz 10 1 2009

Using Ajax in a web application makes a better user experience and if used well, it even improves performance! But it's not all advantages. With the change of a technology, of an approach we need to adjust our way of thinking and the way we apply our solutions for different task.

This might be a bit abstract, so I'll get specific about what I mean. As often met, when you click certain controls on a webpage, you expect to see an outcome, a result or a message as a response to your "request". What Ajax does is ... it replace only certain regions of your webpage. If that region isn't in the visible in the current scroll position of your page in the browser, you won't see the effect. » Continue reading ...

Refresh BlogEngine.net Posts - Clear Cache

by Arnold Matusz 12 12 2008

Lately I’ve come across an interesting situation involving BlogEngine.Net. I normally use Windows Live Writer to write my blog posts, and as I really love to post some programming related articles I use Syntax Highlighter. Sadly I don’t have Windows Live Writer set up (with all the plugins) on each workstation I work on, so whenever I need to change something in a post (typos, updates, etc.) and WLW is not at hand I get down and dirty and edit the XML files which the posts are saved in.

I hear you asking: Why you stupid idiot are you doing that when you can edit your posts in a nice WYGIWYS editor? Well, the only reason is that when I post code samples those need to be in pre tags where each and every space i very important. And after I edit/save a post in BE’s (online) the formatting is lost. » Continue reading ...

Failed to map the path '/App_GlobalResources/'

by Arnold Matusz 19 11 2008

The scenario: I’ve been using Visual Web Developer 2008 for a web application and after I moved the application from the inbuilt ASP.NET Development Server to IIS I encountered the following exception message:

Failed to map the path '/App_GlobalResources/'


There are a few blog posts out there which may apply to your case, especially if you have Crystal Reports 8 installed. Worth mentioning is: www.thejoyofcode.com. If your situation is proior to Visual Studio 2008 you might find your solution immediately in the blog content, but if the concern is a bit newer reading through each comment might be helpfull. » Continue reading ...

ValidationSummary displayed multiple times in UpdatePanel

by Arnold Matusz 14 10 2008

Restricting the user from leaving certain fields blank is often mandatory, because we don't want to have empty fields in our database, or we may want the user to specify exactly how many products he wishes to order. Asp.net comes in really good here with the Validation Controls. For my example the RequiredFieldValidator is perfectly suited because it displays a little error message for the control it validates.

All is fine until you have 40-50 fields that have to be filled out. In this case it's of good practice to use the ValidatioSummary control which summarises all the error messages from the ValidationGroup and shows them either in text on the page or as a Javascript alert().  » Continue reading ...

Styling a TreeNode with CssClass

by Arnold Matusz 9 10 2008

Web development with Asp.net is very fast. We have drag and drop controls with out of the box functionality. This concept of prebuild controls is of huge advantage when it comes to rapid application development, saving us allot of time ... but there is one major drawback. We are normally limited to what the controls offer in: rendering, functionality, etc.

Microsoft controls normally render table based designs, which are very difficult to style. If you want to override this you can achieve it using CssFriendlyControlAdapters. It's the same case for the TreeView Control but the table based rendering is probably not the thing that bothers me the most! » Continue reading ...

Server.Transfer in an UpdatePanel

by Arnold Matusz 6 10 2008

While writing a short piece of code for my global exception handling post I figured out a nice fact. What I wanted to achieve is to have redirection to a custom error page which displays exception details. This can be easily done by using Response.Redirect() (to ex: ~/exception.aspx"), but this will completely lead to another page. This is not usefull if I'm interested in the actual URL where the exception has been thrown. (ex: ~/products.aspx?catid=4&pageid=7 ..."). By using Response.Redirect() you end up with "/exception.aspx" as the URL in the browser.

An obvious solution at first sight is ... we need to use Server.Transfer() which won't create a new Context (i.e.: the url in the browser will stay the same but we show the contents of a completely new page). And of course this is all fine ... until you need to use this functionality in an ASP.NET AJAX enabled website in an UpdatePanel.

By calling Server.Transfer() during an asynchronous postback the following alert will be displayed:

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html P'.

The reason why you can't use a Server.Transfer() in an UpdatePanel is more and more obvious when you think about what AJAX is. We only request small pieces of markup which replace little portions of a page, the whole point of AJAX is to avoid downloading the whole page again. This means that when triggering an async postback, the PageRequestManager expects to receive some small portion of HTML, but because the Server.Transfer() call was made the actual response is the markup for a completely new/different page (which begins with the DOCTYPE definition, this is what you can see at the end of the exception message).

If you decide to use a Server.Transfer() in an UpdatePanel you can avoid this exception by setting your Trigger to a PostBackTrigger. (i.e. The control which fires the method where Server.Transfer() is called won't cause an async postback!).
» Continue reading ...

About Arnold Matusz

Arnold Matusz

My name is Arnold Matusz. I'm a web developer specialized in .NET technologies with a passion for photography and cars.

View Arnold Matusz's profile on LinkedIn

Who's amung us