Solved

HTML form forces users to download the response.

Posted on 2003-11-12
14
309 Views
Last Modified: 2010-04-09
Here is a weird problem I have been having...

I have a form that posts to an asp page like this:

This form is on the content.html page and posts to the results frame

<form action='http://www.somdomain.com/aspen/page.asp' target='results' method='POST' name='command'>
            cmd<input type='text' name='command'>
            ses<input type='text' name='session_id'>
            ver<input type='text' name='version' value='2.0'>
            <br />
            aic<input type='text' name='aicc_data' size="100">
      </form>

I am using a frame set that is setup like this:

<frameset frameborder="0" border="0" framespacing="0" rows="*,1" onLoad="opener.close();">  
  <frame src="content.html" name="content" frameborder="0">
  <frame src="results.htm" name="results" scrolling="0" frameborder="0">
  <noframes>
   ...
  </noframes>
</frameset>

All the target is doing is preventing my original frame from redirecting to the asp page.  This works fine for some computers but others try to download the response from the asp page as a text file ('page.asp').  Does anyone have any ideas about this problem?
0
Comment
Question by:GreatGatsby
  • 6
  • 3
  • 2
  • +3
14 Comments
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
If you change content.html to content.asp, what happens?
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Also, I believe the target should be set in the frameset, as opposed to the form tag:

<frame src="content.html" name="content" frameborder="0" target="results">

<form action='http://www.somdomain.com/aspen/page.asp' method='POST' name='command'>
0
 

Author Comment

by:GreatGatsby
Comment Utility
By setting the frame target to my other frame It would only replace my content frame with the information I wanted in the results frame.  The whole idea behind the results frame is that I don't want my content frame to be redirected on a post.  I can't use a .asp page for my content frame becuase it cannont be regenerated each time.  It is running a Flash movie that is communicating with the browsers javacript to get information from the page.asp page that the form submits to.
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
>>I don't want my content frame to be redirected on a post.
So what should happen to content.html after hitting the submit button?
0
 

Author Comment

by:GreatGatsby
Comment Utility
The content.html frame should remain the same.  I am having to fix someone else's code so the forced download does not occur.  The hard thing about this is that it only happens on some computers  not all.  I have tried looking at the browser settings and everything on the computer and cannot find a good reason for this to be happening.  What would cause a browser to download the response to a form rather than to just post it to the correct frame?
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
longshot ... your form is named "command" and one of your inputs is also named "command"
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
The only thing I can think of is if the browser's settings are not setup to handle the asp extension - but that would be unlikely...
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
The input appears to be cmd - not command...
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
Oh, I see what you mean...
0
 
LVL 11

Expert Comment

by:Zontar
Comment Utility
The target attribute should be in the form tag and should use the name of one of the frames.

The form has to submit *to* something, and when it does, the user's browser attempts to load the file in the form's action attribute.

> The only thing I can think of is if the browser's settings are not setup to handle the asp extension - but that would be unlikely...

The browser normally acts according to the content-type header that's sent with the content. What's happening is that the form handler page is sending some content-type other than "text/html". When the form submitted, what filetype/extension shows in the browser's "Save As..." dialogue?

A link or some form handler code would be helpful.
0
 
LVL 5

Expert Comment

by:prohacx
Comment Utility
Have you tried

<form action='http://www.somdomain.com/aspen/page.asp' target='results' method='POST' name='command' enctype='text/html'>

Also, make sure you do not have a form named "command" and an input field named "command" (simply do not name your form can be a solution too...)

Good luck!
0
 
LVL 3

Assisted Solution

by:NeilT
NeilT earned 250 total points
Comment Utility
I had this problem a while ago with a wap site

the solution was solved simply by adding <html>  and </html> openers and closers in the page, as I didn't have them before the asp code tried to push a download

worth a look

Neil
0
 
LVL 11

Accepted Solution

by:
Zontar earned 250 total points
Comment Utility
> the solution was solved simply by adding <html>  and </html> openers and closers in the page, as I didn't have them before the asp code tried to push a download

This might well explain the problem.

Another solution might be to add

Response.ContentType = "text/html"

to the page before any content is sent to the client.
0
 

Author Comment

by:GreatGatsby
Comment Utility
You guys both gave correct answers.  I didn't generate the asp page, so when I was digging through the code I discovered the the ContentType was set to "text/plain" we changed it to "text/html" and no more problems!  Thank you so much!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

10 Experts available now in Live!

Get 1:1 Help Now