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
Solved

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

Posted on 2009-05-12
9
660 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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