473,657 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer

Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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 4527
Just a test,

If you change the Server.Transfer to Response.Redire ct,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer

Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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***@workshar e.com> wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl...
Just a test,

If you change the Server.Transfer to Response.Redire ct,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer

Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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.Ite ms 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.Redire ct,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer

Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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***@workshar e.com> wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl...
Just a test,

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

news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer

Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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 EnableViewState Mac to true for your site, and see if it makes a
difference
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:es******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I suppose this will work, but I can't test in my current context since
I will lose the HttpContext.Ite ms 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.Redire ct,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
> [STEP2] Page_Init...Btn 1_Click...Serve r.Transfer
>
> Page2:
> [STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
> [STEP4] Page_Init...Btn 1_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 EnableViewState Mac to true for your site, and see if it
makes a difference
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:es******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I suppose this will work, but I can't test in my current context
since I will lose the HttpContext.Ite ms 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.Redire ct,
does the ViewState work properly then?
"Gauthier Segay" <ga******@spamm ed.org> wrote in message
news:u6******** *****@TK2MSFTNG P09.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.Ite ms) 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...Pag e_Load...Page_R ender... User click on Btn1
[STEP2] Page_Init...Btn 1_Click...Serve r.Transfer
>
Page2:
[STEP3] Page_Init...Pag e_Load...Page_R ender... User click on Btn1
[STEP4] Page_Init...Btn 1_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
7004
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 changes box1, I want to set the selected index in box2 = 0. When I do this, I dont get an error, but when the page loads, it still has the selected value and not 0. It seems that it is getting the selected value from the viewstate
10
2260
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 disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
1
3745
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 with line 4, my application works. Using Line 1 in combination with line 3 (and of course renaming httpSessionState1 to httpSessionState) results in the error as mentioned below. protected override object LoadPageStateFromPersistenceMedium() {
7
2039
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 them, or how do we get that value? I always have to set the ViewState("FirstName") = txtBox.text myself before a postback is done, otherwise, the value of ViewState("FirstName") is always empty; there doesn't seem to be a way to retrieve that...
2
2214
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 the page get posted back to the server the value of the textbox is gone. How do I preserve the value of the textbox that I entered in it? I don't want to use Cache/Session to keep track of the value. That's not an option. Thanks for your...
11
2472
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 and in this case I redirect to another page, HOWEVER, I get Invalid ViewState exception. I know the problem stems from server.execute but don't know why. Any Ideas? Thank you.
10
3077
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 config does specify a machinekey setting: <machineKey validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
6
2851
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 order for a dynamically created control to persist its state, it needs to be created and loaded into the page control hierarchy before the viewstate is loaded. The proposed solution, and that which I have been using, has been to create all of...
4
5049
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 textbox and a dropdowlist: and a button to start something n code-behind: a refresh doesn't send any value back to the server but with a postback, the values are sent? But then, which role does Viewstate play in the postback proces?
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8743
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.