ASP.NET 2.0 Experience

Posted: Thursday, September 8, 2005 in

Finally we released the version 1 of the FAQ system that we build on ASP.NET 2.0
Overall it was a pretty enjoyable project and still lot more work ahead to do.
I hope to put down some of key things that I have learnt from this project.
same post is available in our

1) sessionState “StateServer” dual processor
The customer requirement was to deploy the system in dual processor server, and because of that we need to move the sessionState mode from inproc to “StateServer”. And there was a restrction when we try to keep a object in session object, Because the session is not handle by the processor and its in StateServer (windows service runing in the meshine).to over come the we had to serialize the object with the [Serializable] attribute .

2)select scope_identity()
in SQl when we need to insert a record to a table that has a Auto indenity increment primary key (Auto id) and to get that new id, you can use

INSERT INTO [Table] (field1,filed2) VALUES(“@field1,@ filed2) select scope_identity()”;

When you exicute this using ExecuteScalar() method it will return the new id

I blogged about this earller also
You can check if string is NULL or Empty in one condition

string a “”;
if (string.IsNullOrEmpty(a))

4) int.TryParse
this is a coll way to convert a string to int and also check if the string is in correct format

string strScore TextBox1.Text;
int intScore 0;
if (int.TryParse(strScore, out intScore))
int FScore intScore + 200;
Label1.Text FScore.ToString();
Label1.Text “please type a valied number “;

5) Deployment issue
Small thing to keep in mind when publishing a web site in VS 2005 (Buil>Publish) VS will only publish the nessasary files and DLLs to the server. But if you have an .scc file (Visual source safe status) in deployment machine that file will also be pubshed. So remember to delete that fime from the published server.

6) if(!IsPostBack)
In ASP.NET 1/1.1 when we tried to data bind to a data control we did in if(!IsPostBack) to keep it happen only once. But the cool thing in ASP.NET 2 is we dont have to check for that. will see if the controls viewstate is available or not, and if that is available will automatically ignore the binding part. J

Well that some I can remember hope phase 2 of our project will have more cool things.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s