WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How to

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Webpage Redirect


Question:

Is there a comparable function for WebBatch like Redirect in ASP?

Answer:

I guess you could write a UDF to handle this. There are a few possible options:

Using a Meta tag

#DefineFunction WebRedirect(URL)

   WebOut(StrCat('Content-type: text/html',@CRLF,@CRLF,'<HTML><HEAD><META http-equiv="refresh" content="0; URL=', URL, '"></HEAD><BODY><A HREF="', URL ,'">', URL, '</a></body></html>'), 1)

#EndFunction

WebRedirect("http://www.winbatch.com/")


Status 302 Redirect

#DefineFunction Redirect(url)

   WebOut("Status: 302 Found",1)
   WebOut(StrCat("Location: ",url),2)   ; NOTE 2 CRLF's after url !

#EndFunction

Redirect("http://www.winbatch.com/")


Status 302 Redirect with html


#DefineFunction RedirectWithHTML(url,html)

  WebOut("Status: 302 Found",1)
  WebOut(StrCat("Location: ",url),1)    ; NOTE 1 CRLF after url !
  WebOut("Content-type: text/html",2)   ; NOTE 2 CRLF's after url !
  WebOut(html,1)                        ; assumes html is some properly formatted html for a display page

#EndFunction

html = '<HTML><HEAD></HEAD><BODY>Redirecting you to <A HREF="http://www.winbatch.com/">http://www.winbatch.com/</a></body></html>'
RedirectWithHTML("http://www.winbatch.com/", html)

To see a list of other 'Status code definitions' check out:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10


Article ID:   W16301
File Created: 2005:02:18:12:19:42
Last Updated: 2005:02:18:12:19:42