Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 30, 2010 06:59 PM by fanette48
Feb 07, 2007 04:39 AM|LINK
I would like to
parameter of ASP.NET script in
example : /localhost/example.asp?parameter1
How can i to get
this parameter ?
can you give me a example? ( using C#)
Thanks a lot
Feb 07, 2007 04:47 AM|LINK
To get a querystring you can use the Request.Querystring property:
Feb 07, 2007 05:13 AM|LINK
Actually in C# it would be:
//this takes request parameters only from the query string
//this one works for bot - form and query string
Feb 07, 2007 05:17 AM|LINK
if (Request.QueryString["param1"] != null)
Response.Write("From Page1 param1 value=" + Request.QueryString["param1"]);
Feb 07, 2007 05:23 AM|LINK
lol, sometime by sitting with a VB.Net project at the moment can destroy the way of writing C#,
or the syntax can in a hurry be written wrong ;)
To add something vaulable to this post, you can also use Request.Params["parameter1"]
Feb 07, 2007 05:30 AM|LINK
In the first page
and in the second page that is a.aspx
Feb 07, 2007 05:36 AM|LINK
thanks for you all
I'm sorry... but I still can't understand...
how about this example of url :
I want to get "1566979"
is it correct →Request.Querystring("PostID") and I can get 1566979
once I get postID (1566969) I'll replace the X as 1566979
string strConn = "data Source=x.x.x.x;user=sa;password=1234;initial catalog=Member";
string strSQL = "select Subject,nContent from pro_News where Member_no = "x" ";
SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand(strSQL,conn);
cmd.CommandType = CommandType.Text;
SqlDataReader dr = cmd.ExecuteReader();
Label2.Text = (dr["Address"].ToString());
Feb 07, 2007 05:52 AM|LINK
the first page is writted with VB by other people ( I can't modify it..)
if I did
then I can get a=18 , b=100 is it correct??
Feb 07, 2007 06:11 AM|LINK
if you have this link below
a = 1
b = 100
Feb 07, 2007 06:38 AM|LINK
hi, how do I know which should I put it in response.redirect( )?
I have 2 page now ( a is writted by VB .. I can't modify it.. , b is writted by C#)
page a is shows many title... and once user click one of them it will direct to page b. page b will shows content which user click from page a..
so that's why I'm wondering .. is it ok? get parameter in url when we are in page b...