T O P I C R E V I E W |
tribaliztic |
Posted - 19 September 2007 : 08:03:34 How can I "convert" a querystring?
I have a modded version of Marcel's blog mod and it use the querystring "log_id". However there are some autogenerated links that point to the blog mod with the old "TOPIC_ID" querystring...
I tried this:
if not Request.QueryString("TOPIC_ID") = "" then T_ID = Request.QueryString("log_id") Response.Write(" T_ID ") Response.Redirect("grarticles.asp?log_id=T_ID") end if
but that didn't work, why? =) < |
9 L A T E S T R E P L I E S (Newest First) |
tribaliztic |
Posted - 20 September 2007 : 04:44:03 Okay, it's just me being a n00b, sorry =) < |
Shaggy |
Posted - 20 September 2007 : 04:39:02 quote: Originally posted by tribaliztic ... can't I just make cLng(Request.QueryString("log_id") understand what's in the cLng(Request.QueryString("TOPIC_ID") ?
That's what my code does, assigning the value to a variable. Replacing all occurrences of request.querystring("log_id") with T_ID in your code shouldn't have messed anything up for you but, if you've found another way around it that works for you, fair enough.
< |
tribaliztic |
Posted - 20 September 2007 : 03:08:01 I did another workaround =)
On topic.asp I added this:
strSQL7 = "SELECT FORUM_ID FROM FORUM_TOPICS WHERE TOPIC_ID = " & cLng(Request.Querystring("TOPIC_ID")) & "" set ARTrs = Server.CreateObject("ADODB.Recordset") ARTrs.open strSQL7, strConnString if not ARTrs.EOF then if ARTrs("FORUM_ID") = 85 then Response.Redirect("grarticles.asp?log_id=" & cLng(Request.Querystring("TOPIC_ID")) & "") end if end if ARTrs.close
To check if the topic is supposed to be an article, then redirect to the article mod.
This soled my problem, but maybe not in the best way =)
Thanks Shaggy for your time! < |
tribaliztic |
Posted - 20 September 2007 : 02:26:42 Hm.. you mean I should replace all instances of: cLng(Request.QueryString("log_id") with T_ID ? This will probably mess things up for me, can't I just make cLng(Request.QueryString("log_id") understand what's in the cLng(Request.QueryString("TOPIC_ID") ? =) < |
Shaggy |
Posted - 19 September 2007 : 09:12:25 Go it, didn't realise you were placing this code on the page you were redirecting to so what I gave you was creating an infinite loop.
Here's the code you need:T_ID=request.querystring("log_id")
if len(T_ID)=0 or not isnumeric(T_ID) then T_ID=request.querystring("TOPIC_ID")
if len(T_ID)>0 and isnumeric(T_ID) then
response.write "Code"
else
response.write "Error"
end if There's actually no need for the redirect, just be sure to reference T_ID everywhere within your code. The "Code" I've highlighted in green above is where you place the code for your page, the "Error" is whatever error you want to present to members if T_ID is not valid, i.e., it's empty or doesn't have a numeric value.
< |
tribaliztic |
Posted - 19 September 2007 : 08:58:49 The page takes forever to load and then nothing happens. I've mailed link to you.. < |
Shaggy |
Posted - 19 September 2007 : 08:47:27 Sure it's a 404 & not a 500? Got Linkage? Deleted the "dim T_ID" line above as it's not really necessary and may be the cause of a 500 error.
< |
tribaliztic |
Posted - 19 September 2007 : 08:45:10 Hm... when I added that code I got a 404-error on the page =) < |
Shaggy |
Posted - 19 September 2007 : 08:28:43 T_ID=request.querystring("log_id")
if len(T_ID)=0 or not isnumeric(T_ID) then T_ID=request.querystring("TOPIC_ID")
if len(T_ID)>0 and isnumeric(T_ID) then
' response.write T_ID
response.redirect "grarticles.asp?log_id="&T_ID
else
response.write "Error"
end if < |