2 Replies - 1846 Views - Last Post: 24 October 2011 - 08:48 PM Rate Topic: -----

#1 vbnewbi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-October 11

Response.Redirect "?src=" paramter

Posted 24 October 2011 - 03:17 PM

Hi, I'm fairly new to VB.net. I'm creating a basic website in Visual Web Developer 2010 Express in ASP.NET/VB and I'm trying to find out how to use Reponse.Redirect with a "?src=" to redirect to another site and keep the same source string in the redirected site.

For example:

Visitor goes to www.test.com?src=source1 and gets redirected to www.site-a.com?src=source1
Visitor goes to www.test.com?src=source2 and gets redirected to www.site-a.com?src=source2
and so on

I don't want to hard code:
Response.Redirect("http://site-a.com?src=source1")
for each possible source. I want whatever source string is in the original visit to pass into the Response.Redirect and show on the destination page, something like:
Response.Redirect("http://site-a.com?src=" + mysource)
But how do actually I code this in VB.net to read the source string in the first URL and automatically add it to the destination URL?

Thanks for any help on this.

Is This A Good Question/Topic? 0
  • +

Replies To: Response.Redirect "?src=" paramter

#2 BrairMoss  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 15
  • View blog
  • Posts: 81
  • Joined: 13-April 10

Re: Response.Redirect "?src=" paramter

Posted 24 October 2011 - 05:59 PM

VBNewbi,

Before I get started on a thought, I must stress that since I do not actually know much VB.Net, though I will try it out after posting my idea.

I believe you should just be able to either grab the source or Query string, and append it to the new URL. Or you may have to parse through the URL, splitting at the ? and taking everything after and adding.

I would suggest seeing if there is a way to steal the query string first, as that would be easiest. I will try it out on VB.Net right now and get back to you soon with my results. In the mean time, I hope I have given you an idea on how to accomplish this.

I apologize if it was of no help.

//BrairMoss

Haha, a nice quick fast reply. I did a quick little Google search, and I just found this it may be what you are looking for.

Where it uses
Request.QueryString("ProductID")
you could try replacing with
Request.QueryString("src")
.

This can also be useful for making "beta" changed to a live ASP site. I learned to do that with PHP recently myself.

//BrairMoss
Was This Post Helpful? 0
  • +
  • -

#3 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

Re: Response.Redirect "?src=" paramter

Posted 24 October 2011 - 08:48 PM

this might work, i'm more of a C# guy so there may be a better way


        Dim query As String
        If Not Request("src") Is Nothing Then
            query = Request("src") 'This is shorthand for Request.QueryString("src")
            Response.Redirect("http://site-a.com?src=" & query)
        End If



This post has been edited by Nakor: 24 October 2011 - 08:50 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1