i have a javascript alert in C# code like this
if(Session["msg"] != null){
       string msg = (string)Session["msg"];
       if(msg.Length > 2) {
           @: var msg = @msg;
           @: alert(msg);
                               }
But in the view the alert doesn't appear:

The problem is that the alert message is written to the view.
Why does this happen? How can I fix this?
 
     
    