Solved

The requested method POST is not allowed for the URL /index.htm

Posted on 2009-05-12
9
658 Views
Last Modified: 2012-05-06
OK, I am having a problem with a post method linking to another site.  When I try to do the following line of code and link it to another site, I get the following error:

The requested method POST is not allowed for the URL /index.htm

Here is the line of code that I have on my sight that I get the problem with:

<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/rsamurai.jpg" style="margin-left:20px;" PostBackUrl="http://www.rmag.com" runat="server" />

Of course the PostBackURL link has been adjusted for privacy reasons, but what other solution is there for me to add a link to a website imagebutton without running into problems?  Thanks!
0
Comment
Question by:VBBRett
9 Comments
 
LVL 9

Expert Comment

by:tillgeffken
ID: 24362750
Is it your goal to post your form to the other site or just redirect? The error message is coming from the other site, right?
0
 

Author Comment

by:VBBRett
ID: 24362786
Yes, it is my goal to redirect or open the main page of the other site.
0
 
LVL 7

Expert Comment

by:ajolly
ID: 24362788
use

OnClientClick="window.location='http://www.rmag.com'; return false;"
0
 

Author Comment

by:VBBRett
ID: 24362816
That didn't work out too well.  All it did was just shift the page and make me stay on that same page.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:VBBRett
ID: 24362885
This should be a simple task, how do I do this without all the problems?
0
 
LVL 9

Accepted Solution

by:
tillgeffken earned 260 total points
ID: 24362922
This makes it a bit reusable:



<script type="text/javascript">

function redirectTo(url)

{

   window.location.href  = url;

   return false;

}

</script>
 

<asp:ImageButton ID="ImageButton1" ImageUrl="~/images/rsamurai.jpg" style="margin-left:20px;" OnClientClick="redirectTo('http://www.rmag.com'); return false;" />

Open in new window

0
 
LVL 12

Assisted Solution

by:GuitarRich
GuitarRich earned 240 total points
ID: 24362978
This is really simple - just use an anchor tag with an image, no need to over complicate things with postbacks or js imo.
<a href="http://www.rmag.com" style="margin-left:20px;"><asp:Image ImageUrl="~/images/rsamurai.jpg" id="image1" Runat="Server"></asp:Image></a>

Open in new window

0
 
LVL 9

Expert Comment

by:tillgeffken
ID: 24363017
Although that approach will make functionality inaccessible from code behind. Yeah, i know that the image button was missing a runat="server" property =)
0
 

Author Closing Comment

by:VBBRett
ID: 31580463
Thank you very much gentlemen!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

12 Experts available now in Live!

Get 1:1 Help Now