Category Archives: ASP.Net

The project file contains a property value that is not valid – WPF error

Problem:

While developing a WPF application I had created a new project in my solution. I then copied several pages from one project to the new project. On running the application I got the wierd error “The project file contains a property value that is not valid”. I checked the files and codebehind over and over without finding the problem.

 

 

 

 

Solution:

Eventually the problem turned out to be the build action for the pages that I had copied! aaargh. They had been set to “ApplicationDefinition”, setting them back to “Page” solved the problem. Other files like images etc show similar issues so be aware of this!!

 

PRISM application

I’ve been tasked with building a simple proof of concept application by next week. It MUST be modular and loosely coupled. It SHOULD be portable to Silverlight and possibly mobile applications. Not actually having built a WPF application yet this has me excited. As a bonus I get to implement PRISM and the MVVM pattern plus choose a dependacy injection container.

Once the proof of concept succeeds this most likely be the basis of a complete overhaul of the existing systems we are working with! Wish me luck! ūüôā

Update -Right now I’m feeling a bit overwhelmed.¬†After reading some of a ‘Developer’s Guide to Microsoft Prism’¬†yesterday I had the impression I had a choice between 2 depedancy injection containers MEF or Unity (yes there are others but these 2 are for now the most logical choice).

After reading David Hill’s blog (http://blogs.msdn.com/b/dphill/archive/2009/12/09/prism-and-mef.aspx) it seems it can be argued that MEF isn’t even a DI container. In fact MEF and Unity can be used together with PRISM! Obviously I can’t expect to learn these concepts within a week.

Session randomly expiring

Problem:

I had just deployed a new website to my production server running IIS. The client was testing, but complained that the session was timing out too soon.

The website was using a check on session variables to see if the user was logged in and the session was still valid , something like this

¬†if (Session[“CustomerID”] == null)
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† Response.Redirect (“~/SessionExpired.aspx”);

On testing myself it seemeed the session data was randomly expiring. In the development environment there was no problem. I checked the usual culprits: session timeouts in the web.config, IIS session settings, if the anti-virus was touching certain config files etc. No luck…

Then I noticed that the application pool under which the website was running was set to allow 2 worker processes! aha!

Solution:

According to the MS documentation “The in-process session state mode stores session-state data for an ASP.NET application in the worker process where the application runs. This mode is the default for IIS 7.”

The user would login successfully, session data would be stored under that workerprocess. BUT because of the whole http is stateless thing, the user could be randomly swapped to the other workerprocess, which has no knowledge of their previous session data. As the session data was no longer present, my code would inform them their session had expired.

I’m not sure why the pool had 2 workerprocesses allowed, but after setting it to the default of 1, the problem was resolved.

If you’re working with a web-farm or some such dealing with multiple processes then their are alternatives to the InProc sessionstate mode, such as using a SQL server or the ASP.NET State Server service to store session data.