What Peter is saying is that the error you are getting does not match this code:
Line 18: String username = Page.User.Identity.Name;
Line 19: username =username.Replace("GAR\\","");
Line 20: Label2.Text = username;
Line 22: Label2.Text = username.ToUpper();
Calling Replace() will not cause this type of error to be thrown. I most commonly see this error when working with SubString() trying to refer to a position in the string that doesn't exist.
Read this if you want to know how to get a correct reply for your question:
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7