You key info into the first box, press the button and the info from TextBox1 gets put into Textbox2.. It works fine, BUT if two computers get onto the same page it crashes as soon as the second computer presses the button...
What's wrong... Below is the code:
<%@dotnet.itags.org. Page Language="VB" %>
<script runat="server"
' Insert page code here
'
Sub Button1_Click(sender As Object, e As EventArgs)
textbox2.text = textbox1.text
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:TextBox id="TextBox1" style="Z-INDEX: 100; LEFT: 168px; POSITION: absolute; TOP: 56px" runat="server"></asp:TextBox>
<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 56px" runat="server" Width="83px">My Dot Net</asp:Label>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 104px" onclick="Button1_Click" runat="server" Width="88px" Text="Button"></asp:Button>
<asp:TextBox id="TextBox2" style="Z-INDEX: 103; LEFT: 176px; POSITION: absolute; TOP: 160px" runat="server"></asp:TextBox>
</form>
</body>
</html
Thanks in advance,
JohnThat code looks just fine, and I was able to play with the page from three computers without problems. What do you mean when you say that it crashes? Do you get an ASP.NET exception in a browser? Does one of the browsers hang or just sit there trying to get the page? Does the ASP.NET process crash? It may be some sort of an installation or configuration issue.
-Scott
I have it sitting on our ISP website... You can try http://www.jonkar.ca/nora/xtest.aspx
Once you have one computer on the page, use the app once. Then have another computer goto the same page and try it from that machine..
Try the app about 5 times on each computer going back and forth, and you will receive:
Server Error in '/' Application.
Runtime Error......
I can do it a few times without any problems, but all of a sudden it errors out...
It might do it the first time, or it might take 4-8 times...
Do you think the ISP has a problem?
Thanks,
John
Wow, that's really strange. After clicking around for a while I was able to see the error, too. I think the next step is to allow the error to be sent to remote machines - follow the instructions in the error message to modify your web.config file (or add one, if you don't yet have one) and find out what the error actually is.
-Scott
Okay I added the Web.Config file, and the error I received doesn't mean anything to me...
Server Error in '/' Application.
------------------------
The viewstate is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The viewstate is invalid for this page and might be corrupted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The viewstate is invalid for this page and might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +150
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +423
------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
This is a pretty rare issue, and it is quite likely to have something to do with the way your ISP's machines are configured. I'm asking around on my team for information about how you can troubleshoot the problem. I'll post again when I know more.
-Scott
Could be a caching issue: if some proxy server along the line undistinctively resends cached pages for a given request, it may return viewstates that are not destined to the right client.
I'm really not sure about this, though, but it may be worth checking. One way to check is to send requests from the local network where the server is (to eliminate routers and proxies that might introduce this effect).
Okay I put the application on an IIS server in our office, and it works fine until another computer connects to the application??
Thanks,
John
Another possibility is that your ISP is using a Web Farm (many web servers sharing the job of serving your web site) and that one of them is not configured correctly - that would lead to occasional viewstate exceptions like this one.
If this is the case, when you add EnableViewStateMAC="false" to your Page Directive, the issue should go away.This is insecure, so don't do this for a real site, and change it back when you're done!
If it does go away when you turn off ViewState, I'd recommend contacting your ISP and telling them about what's happening. There's some information in thisarticle about configuring a Web Farm for this under the "ViewState Security on a Web Farm" section near the bottom.
If you still see the problem with EnableViewStateMAC="false", let me know. (There are a few other things we can try.)
Good Luck!
-Scott
<%@. Page Language="VB" EnableViewStateMAC="false" %>
OKAY!!! I tried it for about 30 posts, and it still has not crashed!!!
Great!
Now how do you mean it's not secure??
And where should I go from here...
Thanks,
John
It means that the information you store in the ViewState is not encrypted and can be tampered with if you set EnableViewStateMac to false.
So if you have some sensitive information there, you don't want to set it to false.
Since the issue goes away when you're not encrypting View State, it's most likely because your ISP is using a Web Farm but not all of the machines are configured correctly. You can tell them about the issue and send them the article I mentioned above.
-Scott
This is great post. I spent a lot of time to find solution from the forum and come up with this thread today.
Thank Mr. Scott
0 comments:
Post a Comment