-1

How do i Do this in ASP.NET

in php (For instance) I have this HTML Page and I want to use a Url Content Something like this

http://localhost/?name=Totten&Age=25

In Html (For PHP) Code Looks like this

<!doctype html>
<html>
<?php
$name = $_GET['name'];
$Age = $_GET['Age']
?>
<head>

</head>

<body>
<input type="text" name="name" value="<?php echo $name?;>" />
<input type="Age" name="Age" value="<?php echo $Age?;>" />
<input type="submit" value="submit"/>
</body>
</html>

Now i want to get the same thing in ASP.NET (WebForm)

How is this Done?

Evans
  • 303
  • 4
  • 11
  • Does this answer your question? [Get url parameters from a string in .NET](https://stackoverflow.com/questions/659887/get-url-parameters-from-a-string-in-net) – M. Eriksson Oct 18 '20 at 10:00
  • 2
    When I googled on your title, I found _many_ posts about this. Did you do any research and made any attempts before asking? – M. Eriksson Oct 18 '20 at 10:03
  • The best practice to handle this will depend on which variation of asp.net you're using. Is it MVC? Razor pages? WebForms? Please clarify. Actually also if you search yourself online mentioning your specific version then you can find tutorials showing this kind of thing anyway – ADyson Oct 18 '20 at 10:19

1 Answers1

0

in asp.net, you can/would use code like this:

dim strName as string = Request.QueryString("Name")
dim intAge as integer = Request.QueryString("Age")
Albert D. Kallal
  • 42,205
  • 3
  • 34
  • 51