File Locked after adding it as attachement

No Comments

I was encountering a problem whereby when I was adding an attachement to be sent by email :-

// Create  the file attachment for this e-mail message.

Attachment data = new Attachment(filePath, MediaTypeNames.Application.Octet);

// Add time stamp information for the file.

ContentDisposition disposition = data.ContentDisposition;

disposition.CreationDate = System.IO.File.GetCreationTime(filePath);

disposition.ModificationDate = System.IO.File.GetLastWriteTime(filePath);

disposition.ReadDate = System.IO.File.GetLastAccessTime(filePath);

// Add the file attachment to this e-mail message.

message.Attachments.Add(data);

this same file was being locked and could not be moved to a “processed” folder.  Spent a couple of hours tried to figure out why.  Then I found out what the problem was.

The line of code that did the trick was

message.Dispose();

Fantasy Soccer Management – On Hold

No Comments

Decided to pull the plug again on this Fantasy Soccer application with Silverlight, reason being that first of all I am not sure if I want to develop all of it in Silverlight, and also, I am not up to speed enough with Silverlight yet to develop such an application.  I have to really understand how Silverlight and the MVVP pattern works before attempting such a feat.  So I have decided to purchase Pete Brown’s “Silverlight 4 In Action” and from what I have done so far looks pretty impressive.  And who better to learn Silverlight from than the Community Program Manager at Microsoft responsible for Silverlight! So hopefully, after doing this book, I will have some more “light” and continue working on the Fantasy Soccer app again.

Fantasy Soccer Management System

No Comments

As the days are getting colder here in Brussels and the daylight is dimming, I have decided to spend some time working on a project I have shelved for quite some time, which is a Fantasy Soccer Management System.  I have decided to use Silverlight 4.0,  RIA services, Entity Framework and LINQ to do this project.  You may question the motif behind this choice.  Its maybe still a bit risky to use Silverlight, because of its reach.  However, I wish to get to know more abouth Silverlight and RIA services, and I thought the best would be to work on a “real” project and find out the pros and cons of this technology.

I intend to keep updating this blog with the development of this application, including milestones, problems and features I will come up with.  The first beta version of this project should be launched around the end of December, permitting on other projects I have going on at the moment.

So if you are interested in this project, be sure to keep following my blog, and all feedback is very much appreciated.  I will also keep this updated through my twitter account, so make sure to follow me on twitter.

New website

No Comments

Finally I have decided to re-design my personal portfolio, and decided to give WordPress a go.  And I can say that I am pretty amazed on what this tool can do out of the box, with some playing around.  Basically I wanted to put together my posts as well as all the details about me in one place.  I hope you like my website and feel free to contact me and sign my guestbook.

Adding an MVc.NET design template to your project

No Comments

  1. Click the Download button to download the template file to your computer.
  2. Right-click the downloaded .zip file and click the Unblock button (see Figure 3).
  3. Unzip the file to a folder named as the Template you are adding.
  4. Select all of the files from the DesignTemplate folder contained in the folder, right-click the files, and select the menu option Copy.
  5. Right-click your project node in the Visual Studio Solution Explorer window and select the menu option Paste (see Figure 4).
  6. Select the Visual Studio menu option Edit, Find and Replace, Quick Replace and replace [MyMVCApplication] with (the name of your project) .

Mocking an HTTPContext

No Comments

I was trying to write some tests to test the Create method in my Controller and I needed to mock the User.IsInRole("Administrator") so that I can continue with my testing.  So I was looking around for some help, and I found this very interesting blog from Scott Hanselman.

Its a library of MvcMockHelpers using either Rhino Mocks or Moq.

Configuring Exception Handling and logging with Enterprise Library 4.0

No Comments

I have just came across this post by Suleman on how to configure Exception Handling and Logging in the Enterprise Library 4.0.  I found it quite helpful and thought I might share.

The link is as follows

http://www.imason.com/imason_Blogs/b/suleman_ibrahim/archive/2009/05/25/configuring-enterprise-library-4-0-for-exception-handling-and-logging.aspx

Debugging in VS2008 using IIS 7.5

No Comments

This may sound quite simplistic, but took me some time to find out.  If for some reason the default server of VS is not working with your application, you can run your website on your local IIS and then attach a process (CTRL+Alt+P) within VS.  The process is called w3wp.exe and VS should start debugging normally

Login failed for user ‘IIS APPPOOL\’

3 Comments

After about 4 hours battling with this error, and wondering why my website could not load, I managed to figure out what the problem was!  Since I have installed a trial version of Windows 7, IIS 7.5 works differently from Vista’s IIS 7.

So I did the following procedure to get rid of the error and now my website is up and running again on my localhost

  • go into Internet Information Services (IIS) Manager
  • expand node with your computer name on left side and select “Application Pools”
  • now in the window on the right side, right click “Classic .NET AppPool” and select “Advanced Settings…”
  • find “Identity” property and change its value to “LocalSystem”

That solved the problem!

started working on re-designing/re-engineering my portfolio

No Comments

Just started re-designing and re-developing my personal portfolio atwww.johannmontfort.com. The idea is to use MVC+EF+Silverlight+RIA Services+LINQ amongst others.

At the moment I am battling with EF since its the first time I am using it. Its not as easy as LINQ2SQL to use, however its nice to learn a new ORM which I beleive in .NET 4.0 will be much more stable and fun to work with.

So yeah created my database using SQL Server 2008, and now the fun part started with creating the model. Still in early stages though.

Older Entries

Blog WebMastered by All in One Webmaster.