Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.aspnet.caching
Problem with PostBack (ViewState lost
MihranS
4/25/2005 9:19:00 AM
Hi, I have 2 servers behaving different ways I need to know which is
wrong and how to correct it.
When I open the page on from both Servers the caption of the button is
"Test" (because it's not postback and the code from Page_Load runs),
after I click on it, on one of the servers it comes back with caption
"Test" on the other one it comes back with caption "Button"
the value of Session("a") is incremented on both servers which means
that session is not lost. I can't understand the reason.
Thanks!
Here's my code (VB.NET Web Application)
<!-- webform1.aspx -->
<%@ Page Language="vb"
AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="WebApplication1.WebForm1"
enableSessionState=true
%>
<HTML>
<body>
<%=Session("a")%>
<form id="Form1" method="post" runat="server">
<asp:Button id=Button1 runat="server"
Text="Button"></asp:Button>
</form>
</body>
</HTML>
<!-- webform1.aspx.vb -->
Private Sub Page_Load(
ByVal sender As System.Object,
ByVal e As System.EventArgs)
Handles MyBase.Load
'Put user code to initialize the page here
Session("a") += 1
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
If Not IsPostBack Then Button1.Text = "test"
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
End Sub
<!-- global.asax.vb -->
Sub Session_Start(
ByVal sender As Object,
ByVal e As EventArgs)
' Fires when the session is started
Session("a") = 1
End Sub
_______________
Mihran Sahakyan
*** Sent via Developersdex
http://www.develop...
***
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Problem with PostBack (ViewState lost
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password