Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Redirecting

Reply
Thread Tools

Redirecting

 
 
Jim
Guest
Posts: n/a
 
      06-07-2006
Can anyone tell me with this code?

At the moment I enter an email into index.html and when I click submit the
email address passes to add_email.asp which writes the email to email.xml.
Have a look - www.madtim67.com

The code then shows the xml file on screen but I want to redirect it to
another page (just back to index.html). I've tried a few things but none of
them seem to have the desired effect.


add_email.asp
--------------

<% @LANGUAGE = "VBScript" %>

<%

Dim xmlFile
Dim xmlRoot
Dim xmlNode
Dim strTitle
Dim strError
Dim strPath

strPath = Server.MapPath("db/email.xml")

Set xmlFile = Server.CreateObject("Microsoft.XMLDOM")
xmlFile.Async = False

If Not xmlFile.Load(strPath) Then
Call Server.Transfer("invalid.html")
End If

Set xmlRoot = xmlFile.DocumentElement

Set xmlNode = xmlFile.CreateElement("message")
Call xmlNode.SetAttribute("timestamp", Now)
Call xmlRoot.AppendChild(xmlNode)

Set xmlRoot = xmlNode

Call CreateElementNode("user","userName",xmlNode)

Call xmlFile.Save(strPath)

Call Server.Transfer("db/email.xml")

Sub CreateElementNode(elementName, formElement, node)

Set xmlNode = xmlFile.CreateElement(elementName)
xmlNode.Text = Request(formElement)
Call xmlRoot.AppendChild(node)

End Sub

%>

P.S can anyone help me with checking to see if the email address entered
already exists in email.xml


 
Reply With Quote
 
 
 
 
Bo
Guest
Posts: n/a
 
      06-09-2006
Jim,

Your call 'Call Server.Transfer("db/email.xml")' does just that - the
server stops executing your ASP script (presumably add_email.asp) at
that point and switches to executing email.xml instead. All the server
does with email.xml is to send it to the browser. So your code after
that Server.Transfer call never gets executed.

What you would do is to put Call Server.Transfer("index.html") as your
very last statement. And do whatever you intend to to with email.xml
before that.

/Bo

Jim wrote:
> Can anyone tell me with this code?
>
> At the moment I enter an email into index.html and when I click submit the
> email address passes to add_email.asp which writes the email to email.xml.
> Have a look - www.madtim67.com
>
> The code then shows the xml file on screen but I want to redirect it to
> another page (just back to index.html). I've tried a few things but none of
> them seem to have the desired effect.
>
>
> add_email.asp
> --------------
>
> <% @LANGUAGE = "VBScript" %>
>
> <%
>
> Dim xmlFile
> Dim xmlRoot
> Dim xmlNode
> Dim strTitle
> Dim strError
> Dim strPath
>
> strPath = Server.MapPath("db/email.xml")
>
> Set xmlFile = Server.CreateObject("Microsoft.XMLDOM")
> xmlFile.Async = False
>
> If Not xmlFile.Load(strPath) Then
> Call Server.Transfer("invalid.html")
> End If
>
> Set xmlRoot = xmlFile.DocumentElement
>
> Set xmlNode = xmlFile.CreateElement("message")
> Call xmlNode.SetAttribute("timestamp", Now)
> Call xmlRoot.AppendChild(xmlNode)
>
> Set xmlRoot = xmlNode
>
> Call CreateElementNode("user","userName",xmlNode)
>
> Call xmlFile.Save(strPath)
>
> Call Server.Transfer("db/email.xml")
>
> Sub CreateElementNode(elementName, formElement, node)
>
> Set xmlNode = xmlFile.CreateElement(elementName)
> xmlNode.Text = Request(formElement)
> Call xmlRoot.AppendChild(node)
>
> End Sub
>
> %>
>
> P.S can anyone help me with checking to see if the email address entered
> already exists in email.xml


 
Reply With Quote
 
 
 
 
jim
Guest
Posts: n/a
 
      06-11-2006
Thanks very much, i cant believe I never saw that.


Bo wrote:
> Jim,
>
> Your call 'Call Server.Transfer("db/email.xml")' does just that - the
> server stops executing your ASP script (presumably add_email.asp) at
> that point and switches to executing email.xml instead. All the server
> does with email.xml is to send it to the browser. So your code after
> that Server.Transfer call never gets executed.
>
> What you would do is to put Call Server.Transfer("index.html") as your
> very last statement. And do whatever you intend to to with email.xml
> before that.
>
> /Bo
>
> Jim wrote:
>> Can anyone tell me with this code?
>>
>> At the moment I enter an email into index.html and when I click submit the
>> email address passes to add_email.asp which writes the email to email.xml.
>> Have a look - www.madtim67.com
>>
>> The code then shows the xml file on screen but I want to redirect it to
>> another page (just back to index.html). I've tried a few things but none of
>> them seem to have the desired effect.
>>
>>
>> add_email.asp
>> --------------
>>
>> <% @LANGUAGE = "VBScript" %>
>>
>> <%
>>
>> Dim xmlFile
>> Dim xmlRoot
>> Dim xmlNode
>> Dim strTitle
>> Dim strError
>> Dim strPath
>>
>> strPath = Server.MapPath("db/email.xml")
>>
>> Set xmlFile = Server.CreateObject("Microsoft.XMLDOM")
>> xmlFile.Async = False
>>
>> If Not xmlFile.Load(strPath) Then
>> Call Server.Transfer("invalid.html")
>> End If
>>
>> Set xmlRoot = xmlFile.DocumentElement
>>
>> Set xmlNode = xmlFile.CreateElement("message")
>> Call xmlNode.SetAttribute("timestamp", Now)
>> Call xmlRoot.AppendChild(xmlNode)
>>
>> Set xmlRoot = xmlNode
>>
>> Call CreateElementNode("user","userName",xmlNode)
>>
>> Call xmlFile.Save(strPath)
>>
>> Call Server.Transfer("db/email.xml")
>>
>> Sub CreateElementNode(elementName, formElement, node)
>>
>> Set xmlNode = xmlFile.CreateElement(elementName)
>> xmlNode.Text = Request(formElement)
>> Call xmlRoot.AppendChild(node)
>>
>> End Sub
>>
>> %>
>>
>> P.S can anyone help me with checking to see if the email address entered
>> already exists in email.xml

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CCM41 - Displaying originator number when redirecting Tor-Ivar Kristoffersen Cisco 0 03-07-2006 10:56 PM
redirecting stderr and stdout Jon Landenburer Perl 1 05-13-2004 07:38 AM
Redirecting HTTP traffic based on host-header (or URL request) Tim Mavers Cisco 3 04-13-2004 06:31 PM
Redirecting a HTTP POST with CSS dmcknigh Cisco 0 10-18-2003 04:30 PM
Redirecting all WWW traffic CybrSage Cisco 7 07-19-2003 03:03 PM



Advertisments