Friday, October 29, 2010

Computing First and Last Day of the Month

I stumbled across this the other day and I thought it was so slick I would share.

This example computes the DateTime for both the first and last day of the current month.

var monthStartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
var monthEndDate = start.AddMonths(1).AddDays(-1);

You can take the range even further by changing the “AddMonths” number.

Pretty slick.

Saturday, October 9, 2010

Issue: IIS7 “Reports” folder is requiring Windows Authentication

I’ve been working on a ASP.NET project that contained a sub folder call “Reports.” Oddly, every time I tried to browse to it under IIS7 I would get prompted with a “Windows Authentication” dialog.

I had never programmed this, and couldn’t figure out why it was required.

Turns out, the issue was with having SQL Server Reporting Services installed. SSRS by default uses the “Reports” virtual directory under port 80 as it’s Report Manager URL.

After I changed the “Report Manager URL” within the “Reporting Services Configuration Manager” everything was right with the world again.

I just thought I would share this with everyone in case someone else runs into the problem.

Details:

I’m using IIS7 and SQL Server 2008