Solved

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

Posted on 2009-05-12
9
657 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

19 Experts available now in Live!

Get 1:1 Help Now