Reading the variables in a http://www.site.com?x=value1&y=value2

laredo512

Regular
Joined
Jan 6, 2004
Messages
88
Location
Far enough to see snow in winter
I have a small project where my website is supposed to accept specific values from another site to authenticate the users. I have no problems with authenticating, I just need to know how to get the variables passed down to me, and send back a confirmation to the originator. The code behind my website is VB.NET

Example:

Server 1 sends the user to my site with a link

http://www.website.com/enter.aspx?id1=value1&id2=value2

I want my server to get the values for id1 and id2, do what it has to do, then send back to server 1 the following

http://www.server1.com/received.aspx?id1=newValue&id2=newValue

Im not sure how to use the httpRequest or request("fieldName") to acheive this.

Any pointers or examples?

Thanks
 
Manually form your new URL and use Response.Redirect to send to that server.

HttpRequest and Request is just for retrieving data from Querystring
 
get the values by using request.querystring("idX")
do what ever u want to do then
response.redirect("http://www.server1.com/received.aspx?id1=" & newValue & "&id2=" & newValue
 
Thanks!

Now that I know how to get the variables, I have a follow up on the posting back to server 1 side.

When this user is authenticated, the goal is to redirect the user within my site (thats not a problem, I use forms authentication for that) and at the same time I want my server to send back the confirmation to server 1 (the originator) that my server processed the request sucessfully via a URL like:

http://server1.com/responseok.aspx?id1=variable

If I use Response.Redirect, won't that send the user back to server1? Is there another way?

Thanks for any input...
 
laredo512 said:
Server 1 sends the user to my site with a link

http://www.website.com/enter.aspx?id1=value1&id2=value2

I want my server to get the values for id1 and id2, do what it has to do, then send back to server 1 the following

http://www.server1.com/received.aspx?id1=newValue&id2=newValue

how about this?

enter.aspx.cs:

// if id1 is a string
id1 = Request.QueryString["id1"];

// if id2 is an integer
id2 = int.Parse(Request.QueryString["id2"]);

// do what you want

// redirect
Server.Redirect ("http://www.server1.com/received.aspx?id1="+id1+"&id2="+id2.ToString());
 
Back
Top