hi! In php we use this

<a href="hello.php?a=1&b=2">hello</a>

so that when we click, the $_get will catch the value of a and b. If i used asp.net what is the code to link for it?. I need your help, I'm new in using asp.net.

Use Request collection.

C#

String value1=Request["a"];
  String value2=Request["b"]

VB.NET

Dim value1=Request("a")
Dim value2=Request("b")

it means that in asp.net you can also use this code

<a href="hello.php?a=1&b=2">hello</a>

and this code

1.
      String value1=Request["a"];
   2.
      String value2=Request["b"]

will catch the value of a and b. Am i right?

Requested page must be .aspx

<a href="hello.aspx?a=1&b=2">hello</a>

hello.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <%
     String v1 = Request["a"];
     String v2 = Request["b"];

     Response.Write("<br/>" + v1 + " " + v2);
     
  %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <a href="hello.aspx?a=1&b=2">Hello</a>  
    </div>
    </form>
</body>
</html>

thanks you very much. i will try this at my home.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.