string name = Session["UserName"];
if(string.isNullOrEmpty(name))
Response.Write("welcome guest");
else
Response.Write("welcome "+name);
You can write it in single line as below.
Response.Write((string.isNullOrEmpty(name)) ? "Welcome guest" : "Welcome "+name);
No comments:
Post a Comment