Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello

I got an issue with loadbalancing.

I use a website which has two servers to maintain the load balancing.
I use view state values through out my website.When the request changes from one server to another server, i am losing the viewState values.

If i am in a form filling up some details, If the request processed by same server, I can go through everything with out any problem But if the request shifted to other server it popping up the error that the variable missing error(something called input string)

How to solve this proble. Please help me guys.
How to keep track of the viewState, even if the request shifts between servers.

Thank you ...
Posted
Comments
senguptaamlan 23-Dec-10 5:18am    
Have you customized the view state store ...I mean is the view state is getting stored in the HTML of the page or you are maintaining somewhere else??

1 solution

You need to use the same MachineKey for all LoadBalanced servers (Either in the web.config, or, machine.config file). Otherwise, ViewState will cause problem in case of LoadBalanced deployment of Asp.net applications.

See http://wiki.asp.net/page.aspx/1248/aspnet-and-load-balancing/[^] for more.

There are a few other alternative approaches (To use ViewStateMac property). See following:

http://www.c-sharpcorner.com/uploadfile/gopenath/page107182007032219am/page1.aspx[^]

Hope, this helps.
 
Share this answer
 
v2
Comments
Ankur\m/ 23-Dec-10 5:31am    
Correct!
shekhardumala 23-Dec-10 5:34am    
Thank you for your responce.

I will try it and get back,If it works fine.

Thanks a lot.
sjelen 23-Dec-10 8:57am    
Correct about ViewState, this also applies to anything using encryption (like EventValidation).
However MachineKey does not have anything to do with Session. Setting up session in a web farm is complete different problem (you can not use in-proc sessions).
Al-Farooque Shubho 23-Dec-10 9:00am    
Yes, answer corrected. Thanks for the feedback.

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