Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirecting to a URL in an email

Status
Not open for further replies.

mkyzar

Programmer
Oct 19, 2000
56
US
I have a page called leaveslip.html. This page will be emailed to different people in our agency for approvals. When they receive the email, if they are not logged in to our website, they are directed to our log in page which is login.cfm. How do I redirect the user back to leaveslip.html after they have logged in?

I found one thread that suggested setting a variable equal to #cgi.script_name#?#cgi.query_string# but I can't get that to work for me.

 
Here's a common method..

If the user is not logged in, you redirect to login.cfm? Do so like this..

Code:
<cflocation url="login.cfm?done=#cgi.script_name#">

And then a hidden field in your login form

Code:
<cfif parameterexists(url.done)><input type="hidden" name="done" value="#url.done#"></cfif>

And then once they've logged in.. run this code..

Code:
<cfif parameterexists(form.done)>
  <cflocation url="#form.done#">
</cfif>

A few notes..

You may have to work with the content in form.done, it may have more on the path than you want.. like you may want..

/form/page.cfm

but it may be.. /sitename/
depending on the basis of your login, the cflocation might kick the session.. in that event try this..

Code:
<cfif parameterexists(form.done)>
  <cfoutput>
    <script language="javascript" type="text/javascript">
      <!--
        window.location='#form.done#';
      -->
    </script>
  </cfoutput>
</cfif>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
That pointed me in the direction I needed. You rock! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top