Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I having two(index , default) pages. I want to pass value from index(html) page to default(aspx) page.

Index page code has following code.
XML
<input id ="hdn1" value="1" type="hidden"/>
<input id ="hdn2" value ="2" type ="hidden"/>
<input id="Button" value="call Default" type="Button" 
 önclick="window.location.href='http://localhost/test/default.aspx'"/>


on button click in need to access the default.aspx and I am able to load default.aspx. While loading the hidden varible value is comming as null value.

In the default page,I have written following code in page_Init and page_load event.
request.form["hdn1"] -- it is returning null value.
request.urlreferel -- it is returning "default.aspx" value.
both are not correct.

anyone can help me to find the value in next page.

Thanks.
S.Mohanraj.
Posted
Updated 7-May-11 8:38am
v3

Hi mohanraj,
This problem can be tackel in 2 ways

1 way :) use cross page post pack its easy one can find in google ;)
this link might help http://csharpdotnetfreak.blogspot.com/2009/08/cross-page-posting-in-aspnet.html[^]
you have to postback the page to other page not the window.location.href

2nd way :) if you dont want to change your code then just put the hidden values in session or pass them to query string
n ya server.transfer is also an option but not the favorite one :(

hope this will help you let me know if you find it difficult

:) enjoy life
 
Share this answer
 
Thanks for your reply.


The requirement is that we can not use sesstion, querystring and also we can't change anything in the requested page. Because that is not my scope.

my scope is that I can change response page Only.

using the above mentioned code, we have to get the hidden variable value.

Please give me suggestion.

thanks
 
Share this answer
 
try to find out this way

Click[^]
 
Share this answer
 
If I use above solution ,
I am getting below error
"Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. "



And also my requirement is that.

I having two(index , default) pages. I want to pass value from index(html) page to default(aspx) page.

Index page code has following code.

<input id ="hdn1" value="1" type="hidden"/>
<input id ="hdn2" value ="2" type ="hidden"/>
<input id="Button" value="call Default" type="Button"
önclick="window.location.href='http://localhost/test/default.aspx'"/>
on button click in need to access the default.aspx and I am able to load default.aspx. While loading the hidden varible value is comming as null value.

In the default page,I have written following code in page_Init and page_load event.
request.form["hdn1"] -- it is returning null value.
request.urlreferel -- it is returning "default.aspx" value.
both are not correct.

Most important is that, I want read the value of hidden variable.
and requested URL page name.

anyone can help me to find the value in next page.

Thanks.
S.Mohanraj.
 
Share this answer
 
Comments
SachinDabas123 11-May-11 4:49am    
hi Mohanraj,
Tell me one thing is the default page under your scope i.e can you code on the default page ?
Yes. I can do coding in default.
I have written code Request.form["hdn1"]. but it returns null value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900