Solved

VB script in ASP web page quit working!

Posted on 2006-11-28
19
340 Views
Last Modified: 2012-05-05
I just setup our Win 2003 server on new hardware. I used MS's IIS 6.0 Migration Tool to move the web. The old server was 2003 and running IIS 6.0, so there was no conversion necessary. Now one of my applications has quit working and I'm trying to figure out what I didn't change or update that I should have.

Here's the scenario: On another web server, users fill out a form. Each field on the form is named (i.e., <input type="text" name=Name onFocus="nextfield ='Email';" size="30">). This is set up by a Java script. The following command is supposed to ship the field information to an ASP app on my server (the original server doesn't run ASP): (<form method="POST" name=yourform action="http://www.myserver.com/userinfo.asp">). There the user's data is reformatted, put into a text file and emailed to me.

The emailed file arrives just fine. The formatting is correct. Trouble is that none of the user data (contents of named fields) shows up in the file, just the formatting!

As I said, this was working fine prior to moving my web site. An abbreviated copy of the ASP page on my server follows.

<%@ Language=VBScript %>
<HTML>
<HEAD>
<%

Name=Request.Form ("Name")
Email=Request.Form ("Email")
     Set fs=CreateObject("Scripting.FileSystemObject")
     Set msg=fs.CreateTextFile("d:\makeemail.txt", True)
     msg.WriteLine("x-sender: myserver")
     msg.WriteLine("x-receiver: Gazaway@mymail.com")
     msg.WriteLine("Subject: Userdata")
     msg.WriteBlankLines(1)
     msg.WriteLine("Name: "&Name)
     msg.WriteLine("Email: "&Email)

     msg.WriteBlankLines(1)
     msg.WriteLine("End of Data")
     msg.Close
%>

Thanks in advance!
0
Comment
Question by:Gazaway
  • 9
  • 6
  • 2
  • +2
19 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18032811
Gazaway,

Look in the ASP script for a line "On Error Resume Next" and remove it or comment it out if it exists.  Then try it again to see if you get an error.  Let us know of any error you receive and the relevant code.  The portion of script you provided may not even be the problem since the file is created.  

Let me know if you have any questions or need more information.

b0lsc0tt
0
 

Author Comment

by:Gazaway
ID: 18033206
b0lsc0tt,

No such line exists in the file. Where would I find the error log? There is nothing in the Event Viewer.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18033304
Thanks for checking.  That line can suppress an error message but it doen't exist.

Are you getting the 2 lines below in the text file at the end of it?

Name:
Email:

If so, then try adding the line to the script.  The new line is the last one.

Name=Request.Form ("Name")
Email=Request.Form ("Email")
Response.Write "Name is " & Name & " and email is " & Email & "<br>"

Does it print the form field values on the page with the rest of the sentence?  If not, make sure that the form tag is still using the post method.  Do you have other forms on this site that submit to a server page?  Do they have problems?

I just noticed one thing in your first post.  Is the form actually on another server?  Is it still part of the same domain?  I'm not sure how this would effect it since that part is a little out of my expertise but I wanted to clarify.

bol
0
 

Author Comment

by:Gazaway
ID: 18033428
bol,

The output is "Name is and email is" so the form data is not there at all.

Yes, the form is on another server, but this has been working until I moved all MY server stuff to the new hardware. Could there be something blocking the "POST" on my server? I've had a lot of grief trying to get all the necessary port exceptions redefined for the firewall. How does POST work?

Gazaway
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18033450
My expertise is a more limited in this area but I can tell you that information sent by post is placed in the header sent to the server.  It uses the same port so a firewall shouldn't be the issue.  However there may some other security thing on the server preventing it from getting the information.  Let me see if I can get some other experts to look at this and I will see what I can find.  In the meantime make a test form page or move the current one on this server and try it.  If that works then the form page isn't the problem either and the problem is server to server.  Let me know if you have any questions about this or don't understand what I am asking you to do for the test.

bol
0
 

Author Comment

by:Gazaway
ID: 18033561
I moved the htm file from the remote server to my server - and it works! Maybe I can just redirect the links on the remote server to mine, though I'd really like to figure out why it quit working. I still suspect that it's some sort of permissions or blocked port or something like that on my new server.

Gazaway
0
 

Author Comment

by:Gazaway
ID: 18033610
FYI: I'm going home now. It's almost past my bedtime and the cats will be hungry. I'll be back in the office tomorrow, awaiting your reply with bated breath! Seriously, I am very grateful for your help and great ideas for debugging!

0
 
LVL 18

Expert Comment

by:SquareHead
ID: 18033974
Further checking on the "On Error Resume Next" idea: Check for this line in any 'included' asp code you may be using.
0
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 18035265
How about checking to see if there's ANYTHING in the form object?

instead of;

msg.WriteLine("Name: "&Name)
msg.WriteLine("Email: "&Email)

Try

msg.WriteLine("Form: " & Request.Form)
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:Gazaway
ID: 18037820
thefritterfatboy,

Your suggestion resulted worked in that the resulting email contained all the contents of the form (Email Name=yy&Email=zz&B1=Submit). So it appears that the data is arriving at my server and that the formatting part of the asp script is what's broken. Still puzzled by that as no changes were made to the file when it was moved to the new server. Am I missing some configuration parameter in the ASP.NET setup? I've got both versions 1.1.4322 and 2.0.50727 running, same versions as on the old server and the configurations appear to be the same.

SquareHead,

That code doesn't appear anywhere in any of the asp code I'm using in this situation. It must not see this as an error.

Gazaway
0
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 18038695
It's this bit that worries me:

Name=Request.Form ("Name")
Email=Request.Form ("Email")

I'm not sure if Name and Email are reserved words or not.

Could we try strName and strEmail - just to eliminate the possibility?
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18038965
@TheFritterfatboy - They aren't reserved words.  Remember that Gazaway tried the form page on the same server and it did work.  I usually do name variables as you suggest though so I think the suggestion is good general advise.  By the way just to clarify for Gazaway I believe your concern and suggest was just for the variables not the field names from the form.  In the example it would be ...

strName = Request.Form("Name")
strEmail = Request.Form("Email")

bol
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 18039432
Make sure your new server isn't redirecting...such as sending www.myserver.com/userinfo.asp www.myserver.com/userinfo.asp.  Verify by checking your IIS log files in C:\WINDOWS\system32\Logfiles\W3SVC1.

You could try creating a test page that just writes out the variables.  Not tested so watch out for typeo's...

<%
Response.write Request.Form("Name")
Response.write Request.Form("Email")
%>

Also try looping though the forms collection...

<%
For Each strKey In Request.Form
  response.write strKey & " = " & Request.Form(strKey) & "<br>"
Next
%>
0
 

Author Comment

by:Gazaway
ID: 18040364
I've broken something along the way and am getting empty emails. Hold on a bit while I back up to something that works! Also, thanks for all the great suggestions!

Gaz
0
 

Author Comment

by:Gazaway
ID: 18040878
OK, I've got another clue. I took out the text labels and just left the variables. Instead of -

     msg.WriteLine("Name: "&Name)
     msg.WriteLine("Email: "&Email)

I used -

     msg.WriteLine(Name)
     msg.WriteLine(Email)

and the values arrived correctly. Is there something wrong with my syntax?

Gaz
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 250 total points
ID: 18040995
I'm puzzled that the change worked.  It would seem to go against other things we tried earlier.  Oh well, you could try using this instead ...

msg.WriteLine("Name: " & Name)
msg.WriteLine("Email: " & Email)

I didn't think leaving out the spaces between the ampersand (&) would make a difference, especially after other things we tested, but I usually put space between and that is the normal way to write it.  Give that a try and let me know.

bol
0
 

Author Comment

by:Gazaway
ID: 18041148
bol,

Wow! Worked like a champ! Don't know why it changed from one machine to the other, but at this point I don't care! I've awarded the points to you for sticking with me all the way through and coming up with the goods in the end!

Gaz
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18041352
I'm glad it is working and that I could help.  So is the form on the same server as the ASP script page?

Thank you for the grade, the points and the fun question.

bol
0
 

Author Comment

by:Gazaway
ID: 18041990
Yes, but I may move it back to the other server just for kicks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now