Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-05-12
9
Medium Priority
?
668 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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 1040 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 960 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

670 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