简体   繁体   中英

Convert Code Snippet in C# to VB.Net

I want this code in VB.NET I can't convert it...

Code1

Response.Redirect("user.aspx?val=" + txtBox.Text);
string strVal = Request.QueryString["val"];

Code2

Session["val"] = txtBox.Text;
Response.Redirect("user.aspx");
String strVal = (string) Session["val"];

Here's your translation:

Response.Redirect("user.aspx?val=" & txtBox.Text)

Dim strVal As String = Request.QueryString("val")

and

Session("val") = txtBox.Text
Response.Redirect("user.aspx")

Dim strVal As String = DirectCast(Session("val"), String)

Code1:

Response.Redirect("user.aspx?val=" & txtBox.Text)


Dim strVal As String
strVal=Request.QueryString("val")

Code2:

Session("val)=txtBox.Text
Response.Redirect("user.aspx")


Dim strVal As String
strVal=Cstr(Session("val"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM