Solved

Retrieving QueryString Information

Posted on 2007-11-28
5
576 Views
Last Modified: 2011-09-20
This is not an exam or homework

You are in charge of receiving QueryString information for the page "MyPage.aspx", (e.g. "MyPage.aspx?UserName=Bob"). Which of the following reads the information from the QueryString and assigns the value to a label called "Label1" that has been added to the page?

1. Label1.Text = Server.QueryString("UserName")
 
2. Label1.Text = Page.QueryString("UserName")
 
3. Label1.Text = HttpContext.QueryString("UserName")

4. Label1.Text = Request.QueryString("UserName")
0
Comment
Question by:cybernation989
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20363919
>This is not an exam or homework
I am sorry, but this looks too much like it, or like exam preparation.

you should be able to answer that by trying out, if necessary...
0
 
LVL 7

Accepted Solution

by:
Chandan_Gowda earned 250 total points
ID: 20363968
the below one wil work
Label1.Text = Request.QueryString("UserName").ToString()
0
 

Author Comment

by:cybernation989
ID: 20364014
At first I was going to say 2 but after checking out http://www.pcreview.co.uk/forums/thread-1273353.php I would have to say 4 Since I am new to asp.net please let me know what you think
0
 
LVL 7

Expert Comment

by:Chandan_Gowda
ID: 20364025
befor assigning the query string to the label it should be converted to a string
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 20364056
the suggested answer #2 is "misleading".
the "full" code would be Page.Request.QueryString("UserName")...
but "page" is implicitely usable, so answer #4 is correct.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question