8 3419
Badass Scotsman wrote: Hello,
I have a dynamically generated site, with a URL format like so:
www.site.com/index.aspx?Content=Horses www.site.com/index.aspx?Content=Parrots And so on...
What i would like to do, on page somewhere, is this:
if QueryString Content = Horses then 301 permanent redirect to www.newsite.com/animals.aspx?Content=Horses
Trouble is, not really knowing how to code in .NET , im stumped :(
Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then
Response.Redirect("www.newsite.com/animals.aspx?Content=Horses")
End if
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
> Assuming you will use VB.Net, in the Page_Onload event handler, do this: If Request.QueryString("Content") = "Horses" then Response.Redirect("www.newsite.com/animals.aspx?Content=Horses") End if
Hi,
Will the Response.Redirect have the same effect as a 301 permanently moved?
Will it return a 301 value to search engines? (Which is the sole reason for
this task...)
Regards,
Gary.
Badass Scotsman wrote: Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then Response.Redirect("www.newsite.com/animals.aspx?Content=Horses") End if
Hi,
Will the Response.Redirect have the same effect as a 301 permanently moved? Will it return a 301 value to search engines? (Which is the sole reason for this task...)
Regards,
Gary.
No it won't. Response.Redirect simply redirects the browser to the
specified page.
Badass Scotsman wrote: Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then Response.Redirect("www.newsite.com/animals.aspx?Content=Horses") End if
Hi,
Will the Response.Redirect have the same effect as a 301 permanently moved? Will it return a 301 value to search engines? (Which is the sole reason for this task...)
Oh! My bad. I did not read closely enough. The answer is "no". See this
instead: http://www.aspemporium.com/tutorials.aspx?tid=15
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
I'm doing a filter on the useragent and simply clear the response..
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> schreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl... Badass Scotsman wrote: Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then Response.Redirect("www.newsite.com/animals.aspx?Content=Horses") End if
Hi,
Will the Response.Redirect have the same effect as a 301 permanently moved? Will it return a 301 value to search engines? (Which is the sole reason for this task...)
Oh! My bad. I did not read closely enough. The answer is "no". See this instead: http://www.aspemporium.com/tutorials.aspx?tid=15
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
I'm missing something. How does that apply to this issue?
Edwin Knoppert wrote: I'm doing a filter on the useragent and simply clear the response..
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> schreef in bericht news:%2****************@TK2MSFTNGP02.phx.gbl... Badass Scotsman wrote: Assuming you will use VB.Net, in the Page_Onload event handler, do this:
If Request.QueryString("Content") = "Horses" then Response.Redirect("www.newsite.com/animals.aspx?Content=Horses") End if
Hi,
Will the Response.Redirect have the same effect as a 301 permanently moved? Will it return a 301 value to search engines? (Which is the sole reason for this task...) Oh! My bad. I did not read closely enough. The answer is "no". See this instead: http://www.aspemporium.com/tutorials.aspx?tid=15
-- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
OK, think this has cracked it:
<%
If Request.QueryString("Content") = "horses" then
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location",http://www.newsite.com/content.aspx?Animal="&Request.QueryString("Content ")&")
End if
%>
Thanks for the help guys,
Gary.
Badass Scotsman wrote: OK, think this has cracked it:
<% If Request.QueryString("Content") = "horses" then Response.Status = "301 Moved Permanently"
Response.AddHeader("Location",http://www.newsite.com/content.aspx?Animal
="&Request.QueryString("Content")&") End if %>
Why access the querystring value twice? Do you think it's going to
change? ;-)
Why not simply say:
Response.AddHeader("Location","http://www.newsite.com/content.aspx?Anima
l=horses")
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Fredrik Rodin |
last post by:
Hi!
I need to be able to change, add or remove items in the QueryString.
Let say I have the following scenario:
Page_1.aspx display a dropdown list. This list is post-back enabled. It can...
|
by: Jon |
last post by:
Hi,
I have hyperlink objects in a datagrid that redirect the user back to
the current page with this syntax:
<a href="mypage.aspx?id=foo">
When the page reloads, code in Page_Load then takes...
|
by: JenHu |
last post by:
In my restaurant.aspx, I have a 2 dropdownlists (ddlState, ddlCity)
and a button (btnFindRestaurants). The 2 dropdownlist has the first
item as "--Choose--"
After user selected a state and a...
|
by: Jim via DotNetMonster.com |
last post by:
Hi,
I'm passing a variable to another page through a querystring. I then want
to use that variable to retrieve records from a database to poulate a
dropdownlist. I can read the variable from the...
|
by: Dan Sikorsky |
last post by:
How can I get the Querystring passed to the Referring Page from its
referrer?
I don't want the querystring coming to my current page. I want the
querystring that came to the referring page, so...
|
by: Joe |
last post by:
Hello All:
I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId) the first time that it is posted. After the user filles in
the form, he/she clicks a Button...
|
by: Arvan |
last post by:
there is 3 links to page default.aspx,and each one has a querystring,like
a=1, b=1 ,c=1.
problem is how do i ensure the name of querystring!
how do?
|
by: Nirmal Singh |
last post by:
I am a newbie trying to learn ASP.net 2.0.
I want to retrieve the QueryString and process it to produce some
parameters.
I then want to redirect the user to another page, passing these...
|
by: JJ297 |
last post by:
Could someone take a look at this code and tell me if this code is
valid?
Thanks!
If Request.QueryString("quesid") <"" Then
Response.Redirect("CDPadmineditpage.aspx?quesid = """)
End If
|
by: Uwe Braunholz |
last post by:
Hello,
working on a asp.net Website brought me to a strange problem.
I want to enable my users to pass a search string via the query string
of an url.
It works if the user calls the URL...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |