0

I want to Assign session variable using java script. I find this code that works fine

function SetUserName()
{
    var userName = "Shekhar Shete";
    <%Session["UserName"] = "' + userName + '"; %>;
     alert('<%=Session["UserName"] %>');
}

The problem that i use vb.net as language and not c#. I want have the same code with vb.net. Does anybody have any suggestion to resolve this problem?

Thanks a lot in advance.

Dhibi_Mohanned
  • 283
  • 1
  • 7
  • 15

2 Answers2

0

For VB.Net you can rewrite the same as

<%Session("UserName") = "' + userName + '"%>
alert('<%=Session("UserName") %>');

Also if you want to convert your piece of code from c# to VB , you can take help from : http://www.developerfusion.com/tools/convert/csharp-to-vb

Tushar Gupta
  • 15,504
  • 1
  • 29
  • 47
0
<%Session(userName) = "' + userName + '"%>
alert('<%=Session(userName) %>');
F0r3v3r-A-N00b
  • 2,903
  • 4
  • 26
  • 36