Posting onto a form after code executes?

  • Thread starter Thread starter Rob Meade
  • Start date Start date
R

Rob Meade

Hi all,

Ok - I have a bit of a problem with a login page.

Originally it was written in normal asp - the page displayed the form, the
user entered their details, it posted back to itself, validated them and
then posted on again (using a form) to the relevant applications - sending
with it a session id from SQL server.

What I need to do at the moment is create a second stage to this and in
..net...

The process will be like this :

1. .asp page loads and displays form, user enters their details, form posts
to itself and validates.
2. Based on a successful login the .asp has a <form> inside the code which
then posts of to my new .aspx page.
3. the page_onload in the .aspx then takes the values from the hidden form
tags and runs a stored procedure.

All of the above I have running and working fine - but what I need to do now
is post using a form to the application, as I need to send in the hidden
tags the session id etc, I also need to have the action= part of the form
equal the value of a variable....

In old asp I'd have had something like :

<%
' successful log
%>
<body onload = "javascript:document.formname.submit();">
<form action="<%=strURL%>" method="post">
<input type="hidden" name="sessionid" value="<%=strSessionID%>">
</form>
</body>

<%
' not a successful login
%>


etc etc - but I cant work out how to achieve the same in .net - if I create
the form above on the html view in visual studio the form surely needs to
have runat = server - therefore I cant add an action= to it can I?

Any help on this would be appreciate, I am aiming to get this update out
today and this is my only problem at the moment...

Regards

Rob
 
Why don't you just use Server.Transfer to transfer control and HttpContext
to the second page?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
...
Why don't you just use Server.Transfer to transfer control and HttpContext
to the second page?

Hello Kevin,

Thanks for your reply - I haven't used these before - will go see what I can
find - any examples would be handy...

Regards

Rob
 
...
Why don't you just use Server.Transfer to transfer control and HttpContext
to the second page?

Hello again Kevin,

Sorry I should have asked this in my first reply - does it matter that the
..aspx will be going to a normal asp (vanilla asp) page rather than a .net
one?

Regards

Rob
 
Sorry I should have asked this in my first reply - does it matter that the
.aspx will be going to a normal asp (vanilla asp) page rather than a .net
one?

Yes. ASP and ASP.Net are not compatible, do not share the same memory space.
In a case like that you would have to do a form post. A WebForm cannot post
to anything other than itself. Therefore, what you can do is add a normal
HTML form below the WebForm and submit that to change the page.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
...
Yes. ASP and ASP.Net are not compatible, do not share the same memory space.
In a case like that you would have to do a form post. A WebForm cannot post
to anything other than itself. Therefore, what you can do is add a normal
HTML form below the WebForm and submit that to change the page.

Have tried that, but then I need to populate the action= part of the form
with the values of my variables, which dont seem to get picked up from the
code behind page :o/

Rob
 
Back
Top