Let me answer the next part of your question. I will paste your question here from the comments section.
Thanks for quick reply. I am clear about the server.transfer and response.redirect. But as case 1 in my question it persists the hidden fields (showing charactor of .transfer) and changes URL (showing redirect effect). I dont understand why so .. Please help.
Here is your case one -
Case 1: If I do document.form.submit() in javascript on first page. Control goes to 2nd page and persists all the hidden fields of first page and URL gets changes.
There is a lot you need to understand.
When you say
form.submit()
you are submitting the form to the server. The data gets posted back to the web page which is determined by the 'action' attribute of the form that you are submitting. So the hidden field is also available to the posted page.
You may post back to the same page, which is the default behavior for a ASP.NET page.
When you redirect the page using
Response.Redirect
, it redirects you to a different server (can be same). So by default the values should not available to the redirected page. (Http is a stateless protocol, you know that).
You need to read more about
Server.Transfer
and
Response.Redirect
methods. Also you need to understand the page life cycle of ASP.NET page. Link:
MSDN: ASP.NET Page Life Cycle Overview[
^]
And yes, there is a very good article on MSDN about navigation options in ASP.NET. Here it is:
MSDN: Redirecting Users to Another Page[
^]
Read it, I am sure all your doubts will be clear. :thumbsup:
I may not be very clear in my answer. Let me know if you have any doubts.