tags:

views:

106

answers:

2

When an HTML form is posted to a website without specifying the actual page name, it doesn't work.

Non-working code

<form id="userinput" method="post" action="http://website1/"&gt;

Working code

<form id="userinput" method="post" action="http://website1/default.aspx"&gt;

'Default.aspx' is the startup page for this website (configured in IIS) and the page shows up properly if we type "http://wesbite1" in the address bar.

The form is posted to us from a third party site, we are trying to fix this on our end, before asking the third party to fix their code to include the file name.

Environment: .net 3.5, IIS 5.1

EDIT: I tried creating two web applications (v1,v2) on my localhost (two virtual directories) and tried posting (from v1 to v2) the same way, it didn't work either. v2 has default.aspx as startpage and typing localhost/v2 brings up the page.

A: 

perhaps the redirection from / to default.aspx does not redirect post data. Have you tried with other post data type?

Gregoire
I'm afraid, what do you mean by 'Other post data type?'. Can you give me an example?
dabadabadoo
sorry I think you post <input type="file" /> but I was mistaking
Gregoire
+1  A: 

This will not work on IIS versions < 6.0.

I have confirmed your described behavior on IIS 5.1 and have had successful tests on IIS 6.0.

Some consensus can be found here, here and here.

Forgotten Semicolon
Hmmm, why delete answers rather than editing them...? Anyway: good references! So I assume dabadabadoo should have seen some `405 Method not Allowed` then.
Arjan
Thanks! That IS the problem.
dabadabadoo
It double posted on me, Arjan. :-/
Forgotten Semicolon
Aha, well, I still found the other one for the upvote. :-) (@dabadabadoo, did you get that error?)
Arjan
I did and didn't notice the error code until 'Forgotten semicolon' posted the answer.
dabadabadoo