Friday, June 18, 2004

UPDATE: .Stories of a .NET Newbie (4)

1) Starting today I'm using Charles Carroll's Utility Belt ASP.NET library. It's been long since I've seen something so easily incorporated into a development project. And the way .NET handles libraries is just cool. Of course you could just as easily add you own classes, dll's and what not in VS6, but now it just seems so much easier.

2) Cast is giving me the creeps. In ASP doing something like Response.Write varname was a very easy way to put some Session variable or whatever to an asp page. But now, you put a label on the right spot on you page, and then you add to the code-behind:

lblUser.Text = Session("username")

At least, that's what I thought. lblUser.Text Is obviously a string, just like the Session variable. Nope. System.InvalidCastException: Cast from type 'HtmlInputText' to type 'String' is not valid

.NET *really* is an adventurous travel for me...

UPDATE: I'm feeling such a 'n00b' because after just a little reading about sessions I realised you can just as easy bind Objects to a Session. And that was exactly what I did with the following code :)
Session.Add("username", txtUsername)
txtUsername.Value would have been a lot better...