ASP.Net Button with PostBackUrl Alternative

I'm creating a disclaimer page where the user has to accept the agreement to continue I started with the following:

<asp:Button ID="Button1" runat="server" Font-Names="Trebuchet MS" PostBackUrl="http://74.125.159.103/mypage/" Text="Click to Accept" Width="150px" />
and got this error: "The requested method post is not allowed for the url."

I researched and found different recommendations for javascript methods etc. which made no sense to me. If a hyperlink would work why couldn't a button work with it without additional scripting?

I ended up manually creating a button in an external program and doing this:

<asp:HyperLink ID="HyperLink2" runat="server" ImageUrl="~/images/accept.jpg" NavigateUrl="http://74.125.159.103/mypage/"></asp:HyperLink>

But seriously.... please tell me Visual Studio has a better method without requiring an additional script, or creating my own button, that doesn't involve a postback.

Any suggestions would be appreciated. (I'd even be happy if they had a simpler method of the button creation process.)
LVL 1
JB4375Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amandeep Singh BhullarCommented:
ASP Button do not PostBackURL, if you want to open a page, then you must use Hyperlink
0
JB4375Author Commented:
Just seems like an obvious method that would exist. I was sure I was missing something.
0
masterpassCommented:
PostBackUrl is suppoted in the Button control

Have a look : http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20833978.html

make sure you have the form action enabled for the page you are trying to load
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
drypzCommented:
Hi! In your page load event, add this

Button1.Attributes.Add("onclick", "window.open('http://www.yahoo.com','yahoo'); return false;")
0
JB4375Author Commented:
@Masterpass: We're actually using IIS, but I do have some personal pages that use Apache. I'm sure this will come up at some point. Thanks!!

@Drypz: Very concise solution. Very nice, Thanks!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.