HTTP verb POST used not allowed

B

Ben

Hi,

i try to submit a form in an aspx file through javascript to an classic asp
page like this:

<form id="ins" method="post">
<input id="conn" name="conn" type="hidden" />
<input runat="server" id="submit1" type="button" onclick="inexcel()"/>
</form>
<script language="javascript" type="text/javascript">
function infilel()
{
document.getElementById("conn").value=conn
document.getElementById("ins").action="infile.asp"
document.getElementById("ins").submit()
return true;
}

</script>


i get the message: The HTTP verb POST used to access path
'/enquete/infile.asp' is not allowed.

I know classic asp pages are allowed to run because in this asp.net
application, using e.g. window.location.href="myfile.asp" works.

What do i have to change in the configuration of IIS 5.0 (or 6.0) to make
this run, or is it an asp.net issue?

Thanks for help
Ben
 
J

Juan T. Llibre

I'm not sure if this will work, but try :

<asp:Button
ID="Button1"
PostBackUrl="/enquete/infile.asp"
runat="server"
Text="Submit" />

In ASP.NET,. you need to set the PostBackUrl in order to do cross page posting.

I know that works when the page being posted to is an aspx page,
but try it and see if it works for asp pages, too.

What I *do* know is that if you *don't* set the PostBackUrl, you can't cross-post.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
B

Ben

Thanks, i'll try

Juan T. Llibre said:
I'm not sure if this will work, but try :

<asp:Button
ID="Button1"
PostBackUrl="/enquete/infile.asp"
runat="server"
Text="Submit" />

In ASP.NET,. you need to set the PostBackUrl in order to do cross page
posting.

I know that works when the page being posted to is an aspx page,
but try it and see if it works for asp pages, too.

What I *do* know is that if you *don't* set the PostBackUrl, you can't
cross-post.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
B

bruce barker

location.href is a GET. the error means iis is not configred to allow
post to an asp application in the vdir. look at the mapping and add the
POST verb.

-- bruce (sqlwork.com)
 
B

Ben

In the configuration of IIS, in the list of the extentions, there is .ASP
with following verbs:
GET, POST, TRACE, HEAD ..

so ...??
 
J

Juan T. Llibre

Ben, David :

I constructed a simple page which proves that you can post
to an ASP page from an ASPX page using PostBackUrl.

See it working at :

http://asp.net.do/test/cross-post.aspx

Just write your name...and submit the form.
The ASP page returns your name using Request.Form.

Here's the code for the ASPX page :

form ID= "Check" runat="server">
Write your name:
<asp:TextBox ID="Name" runat="server" />
<asp:Button ID= "crosspost" Text="Post to an ASP page" runat="server" PostbackUrl="cross-posted.asp" />
</form>

Here's the code in "cross-posted.asp" :

<%
Response.Write Request.Form("Name") & "<BR>"
%>

It's very simple...and works fine.





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
D

David Wang

I don't think anyone was disproving your statement.

I'm just saying that the error did not come from IIS/ASP, so the issue
comes from how ASP.Net is used. That is certainly correct and not
disproving anything else.

Ben's example was not using PostBackUrl. Perhaps that is the issue...
in which case all is well.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
 
J

Juan T. Llibre

re:
!> I don't think anyone was disproving your statement.

No problem. I didn't think that was the case.
I only wanted to provide the solution.

re:
!> Ben's example was not using PostBackUrl. Perhaps that is the issue...

Indeed, it is the issue. Using PostBackUrl is the solution.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
I don't think anyone was disproving your statement.

I'm just saying that the error did not come from IIS/ASP, so the issue
comes from how ASP.Net is used. That is certainly correct and not
disproving anything else.

Ben's example was not using PostBackUrl. Perhaps that is the issue...
in which case all is well.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top