473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Loosing ViewState on postback

Hello,

I've problem on subsequent postbacks after a Server.Transfer was done.
In our application framework we have a method that pass parameters (via
HttpContext.Items) and navigate to another page (via Server.Transfer),
this work nicely for what it's done for: passing parameters to another
page.

Now my problem is on the destination page, If I affect something to the
viewstate, it's available in the statebag during the current request,
but subsequent postback on the same page loose my viewstate.

Here is a simple stepped exemple to expose my problem in a more
synthetic manner:

========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer

Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============

Clearly, if I put something in viewstate during step3, I got nothing in
it during step4.

It seems to be an asp.net bug.

Do you have a solution or workarround? (I don't want to rely on Session
variables).

Thanks

Gauthier Segay
Nov 19 '05 #1
6 4511
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
Hello,

I've problem on subsequent postbacks after a Server.Transfer was done.
In our application framework we have a method that pass parameters (via
HttpContext.Items) and navigate to another page (via Server.Transfer),
this work nicely for what it's done for: passing parameters to another
page.

Now my problem is on the destination page, If I affect something to the
viewstate, it's available in the statebag during the current request,
but subsequent postback on the same page loose my viewstate.

Here is a simple stepped exemple to expose my problem in a more
synthetic manner:

========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer

Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============

Clearly, if I put something in viewstate during step3, I got nothing in
it during step4.

It seems to be an asp.net bug.

Do you have a solution or workarround? (I don't want to rely on Session
variables).

Thanks

Gauthier Segay

Nov 19 '05 #2
also try Server.Transfer("url.aspx", true)

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:OI**************@TK2MSFTNGP09.phx.gbl...
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
Hello,

I've problem on subsequent postbacks after a Server.Transfer was done.
In our application framework we have a method that pass parameters (via
HttpContext.Items) and navigate to another page (via Server.Transfer),
this work nicely for what it's done for: passing parameters to another
page.

Now my problem is on the destination page, If I affect something to the
viewstate, it's available in the statebag during the current request,
but subsequent postback on the same page loose my viewstate.

Here is a simple stepped exemple to expose my problem in a more
synthetic manner:

========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer

Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============

Clearly, if I put something in viewstate during step3, I got nothing in
it during step4.

It seems to be an asp.net bug.

Do you have a solution or workarround? (I don't want to rely on Session
variables).

Thanks

Gauthier Segay


Nov 19 '05 #3
Hello,

I suppose this will work, but I can't test in my current context since
I will lose the HttpContext.Items parameters.

I think the problem is that the viewstate work for a given url, and
this url is not refreshed while using Server.Transfer.

Thanks for your proposition.

Gauthier Segay

Grant Merwitz wrote:
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
Hello,

I've problem on subsequent postbacks after a Server.Transfer was
done. In our application framework we have a method that pass
parameters (via HttpContext.Items) and navigate to another page
(via Server.Transfer), this work nicely for what it's done for:
passing parameters to another page.

Now my problem is on the destination page, If I affect something to
the viewstate, it's available in the statebag during the current
request, but subsequent postback on the same page loose my
viewstate.

Here is a simple stepped exemple to expose my problem in a more
synthetic manner:

========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer

Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============

Clearly, if I put something in viewstate during step3, I got
nothing in it during step4.

It seems to be an asp.net bug.

Do you have a solution or workarround? (I don't want to rely on
Session variables).

Thanks

Gauthier Segay


Nov 19 '05 #4
Hello,

The problem is the same, and in fact, the overload without the boolean
is passing true by defaul (I've checked with reflector).

Do anyone have another idea?

Do you agree that this is a bug in ASP.NET's ViewState handling?

Gauthier Segay

Onin Tayson wrote:
also try Server.Transfer("url.aspx", true)

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:OI**************@TK2MSFTNGP09.phx.gbl...
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message

news:u6*************@TK2MSFTNGP09.phx.gbl...
Hello,

I've problem on subsequent postbacks after a Server.Transfer was
done. In our application framework we have a method that pass
parameters (via HttpContext.Items) and navigate to another page
(via Server.Transfer), this work nicely for what it's done for:
passing parameters to another page.

Now my problem is on the destination page, If I affect something
to the viewstate, it's available in the statebag during the
current request, but subsequent postback on the same page loose
my viewstate.

Here is a simple stepped exemple to expose my problem in a more
synthetic manner:

========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer

Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============

Clearly, if I put something in viewstate during step3, I got
nothing in it during step4.

It seems to be an asp.net bug.

Do you have a solution or workarround? (I don't want to rely on
Session variables).

Thanks

Gauthier Segay



Nov 19 '05 #5
Just reading this article

http://support.microsoft.com/default...;en-us;Q316920

I know its not the same error, but maybe worth a try
So, Try set EnableViewStateMac to true for your site, and see if it makes a
difference
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
Hello,

I suppose this will work, but I can't test in my current context since
I will lose the HttpContext.Items parameters.

I think the problem is that the viewstate work for a given url, and
this url is not refreshed while using Server.Transfer.

Thanks for your proposition.

Gauthier Segay

Grant Merwitz wrote:
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I've problem on subsequent postbacks after a Server.Transfer was
> done. In our application framework we have a method that pass
> parameters (via HttpContext.Items) and navigate to another page
> (via Server.Transfer), this work nicely for what it's done for:
> passing parameters to another page.
>
> Now my problem is on the destination page, If I affect something to
> the viewstate, it's available in the statebag during the current
> request, but subsequent postback on the same page loose my
> viewstate.
>
> Here is a simple stepped exemple to expose my problem in a more
> synthetic manner:
>
> ========8<============8<============
> Page1:
> [STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
> [STEP2] Page_Init...Btn1_Click...Server.Transfer
>
> Page2:
> [STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
> [STEP4] Page_Init...Btn1_Click... nothing in viewstate
> ========8<============8<============
>
> Clearly, if I put something in viewstate during step3, I got
> nothing in it during step4.
>
> It seems to be an asp.net bug.
>
> Do you have a solution or workarround? (I don't want to rely on
> Session variables).
>
> Thanks
>
> Gauthier Segay

Nov 19 '05 #6
Hello,

I've set this property to true in my base page class, seeing not any
change in behavior.

Thanks for suggesting.

Does anyone have other suggestions?

Does any Microsoft folks is aware of my issue?

Thanks,

Gauthier Segay

Grant Merwitz wrote:
Just reading this article

http://support.microsoft.com/default...;en-us;Q316920

I know its not the same error, but maybe worth a try
So, Try set EnableViewStateMac to true for your site, and see if it
makes a difference
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
Hello,

I suppose this will work, but I can't test in my current context
since I will lose the HttpContext.Items parameters.

I think the problem is that the viewstate work for a given url, and
this url is not refreshed while using Server.Transfer.

Thanks for your proposition.

Gauthier Segay

Grant Merwitz wrote:
Just a test,

If you change the Server.Transfer to Response.Redirect,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spammed.org> wrote in message
news:u6*************@TK2MSFTNGP09.phx.gbl...
Hello,
>
I've problem on subsequent postbacks after a Server.Transfer was
done. In our application framework we have a method that pass
parameters (via HttpContext.Items) and navigate to another page
(via Server.Transfer), this work nicely for what it's done for:
passing parameters to another page.
>
Now my problem is on the destination page, If I affect something to >>> the viewstate, it's available in the statebag during the
current >>> request, but subsequent postback on the same page loose my viewstate.
>
Here is a simple stepped exemple to expose my problem in a more
synthetic manner:
>
========8<============8<============
Page1:
[STEP1] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP2] Page_Init...Btn1_Click...Server.Transfer
>
Page2:
[STEP3] Page_Init...Page_Load...Page_Render... User click on Btn1
[STEP4] Page_Init...Btn1_Click... nothing in viewstate
========8<============8<============
>
Clearly, if I put something in viewstate during step3, I got
nothing in it during step4.
>
It seems to be an asp.net bug.
>
Do you have a solution or workarround? (I don't want to rely on
Session variables).
>
Thanks
>
Gauthier Segay


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
1
by: Ralph Soons | last post by:
Hi all, I am trying to save the viewstate in a session instead of storing it in a hidden of the webpage which is default. This because of performance reasons. When I use line 2 in combination...
7
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get...
2
by: Prodip Saha | last post by:
I am sure there is an easy fix for this problem. I am reloading the same page at an interval using the meta refresh tag in aspx page. This page has one textbox and one button. The problem is -when...
11
by: Nad | last post by:
Hello, I have a page with two link buttons. When I click on the first one I call server.execute("target.aspx") to view target.aspx on the original page. Then I click on the second link button...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
6
by: hlubocky | last post by:
I thought I had a good grasp of the problem related to dynamically creating controls, but it appears that as my application grew in complexity, the problem has resurfaced. As I understand it, in...
4
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.