HTTP verb POST used not allowed

Discussion in 'ASP .Net' started by Ben, Jul 3, 2007.

  1. Ben

    Ben Guest

    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
     
    Ben, Jul 3, 2007
    #1
    1. Advertisements

  2. 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, Jul 3, 2007
    #2
    1. Advertisements

  3. Ben

    Ben Guest

    Thanks, i'll try

     
    Ben, Jul 3, 2007
    #3
  4. Ben

    bruce barker Guest

    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)
     
    bruce barker, Jul 3, 2007
    #4
  5. Ben

    Ben Guest

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

    so ...??
     
    Ben, Jul 3, 2007
    #5
  6. Ben

    David Wang Guest

    David Wang, Jul 4, 2007
    #6
  7. 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, Jul 4, 2007
    #7
  8. Ben

    David Wang Guest

    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
    //
     
    David Wang, Jul 4, 2007
    #8
  9. 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.




    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
    //
     
    Juan T. Llibre, Jul 4, 2007
    #9
  10. Ben

    koreag01 Guest

    K
     
    koreag01, Jun 19, 2012
    #10
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.