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.

Recommended Answers

All 4 Replies

Use Request collection.


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


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

      String value1=Request["a"];
      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>


<%@ 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">
    <form id="form1" runat="server">
     <a href="hello.aspx?a=1&b=2">Hello</a>  

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.