473,503 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redirecting

Jim
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
Jun 7 '06 #1
2 1331
Bo
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


Jun 9 '06 #2
jim
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

Jun 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5049
by: Ivo Woltring | last post by:
Hi Pythoneers, I am trying to make my own gui for mencoder.exe (windows port of the terrific linux mencoder/mplayer) to convert divx to Pocket_PC size. My current app creates a batch script to...
10
1853
by: Kenneth Keeley | last post by:
Hi, I have been having problems with Gecko based browsers not redirecting properly. This is the line of code that does the redirecting: Response.Redirect ("Validation.asp?BookingNo=1234567") ...
0
2556
by: Christophe HELFER | last post by:
hi, I have some problem with redirecting input and output from a process. I can only use VB language (sorry...) Situation: I have to use the Cisco Network Registrar (DNS And DHCP server) ...
3
2307
by: lozd | last post by:
Would appreciate any solutions people could offer for this. Basically I wan't to use a frameset with an aspx page as the contents rather than a htm page and I'd like to be able to redirect the...
0
2117
by: Sune Hansen | last post by:
Hi guys, I really hope someone can help me with my problem. Here is the scenario: I have a development environment on my locale machine. Once in a while when everything has been tested I...
1
1846
by: Bilbo | last post by:
Hello, How do I programatically redirect a page in "another frame" using C# in ASP.NET? Server.Transfer redirects the current page...not a different frame. Thanks.
3
2453
by: tony | last post by:
I've been searching through the threads to find a solution for 401.3 error triggered by windows authentication not being able to redirect to a custom error page to no avail. It seems that ASP.NET...
4
1482
by: Greg Smalter | last post by:
Redirecting from page to page within a web project is pretty easy. However, all Redirect methods take strings as arguments, as if you mistype the string, you don't find out until run time that you...
8
5760
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
17
9442
by: mansb2002 | last post by:
Hi, We recently moved our webserver from Win2K to Win2003. The application works fine. Only problem is that when user views a report as a PDF, IE does not show it. The following code is used to...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.