I am working on someone else's code and I ran into a situation where I was able to cut and paste a rather large chunk of their work - cool, saved a lot of time. The only weird thing was that they have this.
Code:
contact.Id = (int)Session["ContactId"];
When i tried to run that in my new page I get an error saying that the specified cast is invalid. First I thought maybe I was losing the session var somehow - that isn't the case so I did this...

Code:
int contactId = int.Parse(Session["ContactId"].ToString());
contact.Id = contactId;
Works just fine!

Anyone have any idea why this works in one page and not the other? Maybe the other developer is just cooler than I am? (just kidding)

Thanks