Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

phpbb login from ASP

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nospam - 09 Oct 2007 18:20 GMT
Hello,

I need to login to phpbb Forum when user clicks a ASP:Login control.

I can do this by posting a form to phpbb/login.php with username and
password ( the user & password I know ).

My problem is that this has to be on an ASP page.  I don't think you can
embed forms within other forms.

I am able to Response.Redirect("login.php?username=foo;passward=bar")
but the problem is that the URL with password shows up in the browser URL
window.

I tried also the PostbackUrl of a link button and that shows up as well.

Anyone know how to suppress the URL from showing in the window?

Anyone sync'd up several logins at once or have any ideas?

Thanks,
bruce
Mark Rae [MVP] - 09 Oct 2007 18:33 GMT
> I don't think you can embed forms within other forms.

You certainly can, but only one form can be an ASP.NET server-side form
(i.e. with runat="server").

This is actually more common than you might imagine, especially in
e-commerce apps where you need to post to a payment gateway, e.g.

1) Go to http://www.inthecage.co.uk

2) Click Merch

3) Add a product to the cart

4) Click View cart

You'll see the HTML form inside the ASP.NET form

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

nospam - 09 Oct 2007 19:21 GMT
Mark,
Thanks for the info.

I tried to nest the phpbb login form within an ASP:form and received an error:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Sounds like ASP 2.0 is making sure the post is valid.  Not sure about these extra hoops - ClientScriptManager, etc.  It seems reading up on that,   the RegisterForEventValidation is used for Javascript.  

Basically my forms in markup looklike :

<form id="form1" runat="server">

<div>

<form action="phpbb2/login.php" method="post" enctype="multipart/form-data">

<input type="hidden" name="username" value="bruce"><br />

<input type="hidden" name="password" value="bruce"><br />

<input type="submit" value="login" name="login">

</form>

</form>

When I click on the login button, I get the nasty error above.
I can run the form by itself and it runs ok.

Any help would be appreciated.

Regards,
bruce

>> I don't think you can embed forms within other forms.
>
[quoted text clipped - 13 lines]
>
> You'll see the HTML form inside the ASP.NET form
nospam - 09 Oct 2007 19:29 GMT
Interesting. I put the Page directive EnableEventValidation=false at the top of that HTML page,
and it works.  I guess this will do.

So the nested Forms do work.  I guess I'm not sure conceptually what a server side form is.
Is it just a collection of server side controls?

Later,
bruce

 Mark,
 Thanks for the info.

 I tried to nest the phpbb login form within an ASP:form and received an error:

 Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

 Sounds like ASP 2.0 is making sure the post is valid.  Not sure about these extra hoops - ClientScriptManager, etc.  It seems reading up on that,   the RegisterForEventValidation is used for Javascript.  

 Basically my forms in markup looklike :

 <form id="form1" runat="server">

 <div>

 <form action="phpbb2/login.php" method="post" enctype="multipart/form-data">

 <input type="hidden" name="username" value="bruce"><br />

 <input type="hidden" name="password" value="bruce"><br />

 <input type="submit" value="login" name="login">

 </form>

 </form>

 When I click on the login button, I get the nasty error above.
 I can run the form by itself and it runs ok.

 Any help would be appreciated.

 Regards,
 bruce

 "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message news:%23GDSxppCIHA.5360@TK2MSFTNGP03.phx.gbl...
 > "nospam" <no@spam.org> wrote in message news:fLOOi.4753$44.2740@trnddc04...
 >
 >> I don't think you can embed forms within other forms.
 >
 > You certainly can, but only one form can be an ASP.NET server-side form
 > (i.e. with runat="server").
 >
 > This is actually more common than you might imagine, especially in
 > e-commerce apps where you need to post to a payment gateway, e.g.
 >
 > 1) Go to http://www.inthecage.co.uk
 >
 > 2) Click Merch
 >
 > 3) Add a product to the cart
 >
 > 4) Click View cart
 >
 > You'll see the HTML form inside the ASP.NET form
 >
 >
 > --
 > Mark Rae
 > ASP.NET MVP
 > http://www.markrae.net 
 >
bruce barker - 09 Oct 2007 19:45 GMT
xhtml/html does not support nested forms. a page can have more than one
form, but they can not be nested.

-- bruce (sqlwork.com)

> Interesting. I put the Page directive EnableEventValidation=false at the
> top of that HTML page,
[quoted text clipped - 93 lines]
>      > http://www.markrae.net
>      >
nospam - 09 Oct 2007 20:26 GMT
Bruce-
Thanks for clarifying
But I guess you can have an html Form embedded in a Asp:Form ( runat
server).

-bruce.

> xhtml/html does not support nested forms. a page can have more than one
> form, but they can not be nested.
[quoted text clipped - 78 lines]
>>      > http://www.markrae.net
>>      >

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.