Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Asp simple redirect code

Explorer ,
Dec 17, 2007 Dec 17, 2007
I have a simple "vote on video" page. I don´t want users to be able to vote on a video more than once. I put the ID of a video in a session variable once one votes. So now I want to redirect to another page if the session variable = the ID of a video.
I type it in words, but what is the code:

Redirect to page.asp if
Session("vote_id")=Request.QueryString("ID")

Thanks!
TOPICS
Server side applications
591
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 17, 2007 Dec 17, 2007
wavesurfer wrote:
> I have a simple "vote on video" page. I don?t want users to be able to vote on
> a video more than once. I put the ID of a video in a session variable once one
> votes. So now I want to redirect to another page if the session variable = the
> ID of a video.
> I type it in words, but what is the code:
>
> Redirect to page.asp if
> Session("vote_id")=Request.QueryString("ID")
>
> Thanks!
>

<%
If Session("vote_id") = Request.QueryString("ID") Then
Response.Redirect("page.asp")
End if
%>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 17, 2007 Dec 17, 2007
Thanks, that works fine.

However, I need to set the session variable after I do the check, but can´t really figure out how, if I do as follows my update function doesn´t work, any suggestions?

<%
If Session("vote_id") = Request.QueryString("ID") Then
Response.Redirect("page.asp")
End if
%>
<%
Session("vote_id")=Request.QueryString("ID")
%>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 17, 2007 Dec 17, 2007
wavesurfer wrote:
> Thanks, that works fine.
>
> However, I need to set the session variable after I do the check, but can?t
> really figure out how, if I do as follows my update function doesn?t work, any
> suggestions?
>
> <%
> If Session("vote_id") = Request.QueryString("ID") Then
> Response.Redirect("page.asp")
> End if
> %>
> <%
> Session("vote_id")=Request.QueryString("ID")
> %>
>

<%
If Session("vote_id") = Request.QueryString("ID") Then
Response.Redirect("page.asp")
End if
%>

Your logic doesn't make sense, can you explain in more detail what you
are trying to do?

Steve
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 17, 2007 Dec 17, 2007
Doesn´t sound logical, I agree.

However, I want users to be able to visit a update page for a record just once (to vote on a record once only) Therefor first I need check if the sessin var is = records ID, if it is one is redirect. If it is not, then it should be set to records id so that one can´t return.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 17, 2007 Dec 17, 2007
LATEST
wavesurfer wrote:
> Doesn´t sound logical, I agree.
>
> However, I want users to be able to visit a update page for a record just once
> (to vote on a record once only) Therefor first I need check if the sessin var
> is = records ID, if it is one is redirect. If it is not, then it should be set
> to records id so that one can´t return.
>

Now its logical ;)

<%
If Session("vote_id") = Request.QueryString("ID") Then
Response.Redirect("page.asp")
Else
Session("vote_id") = Request.QueryString("ID")
End If
%>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines