D*****n 发帖数: 363 | 1 With Ajax enabled, I start to get these invalid viewstate exceptions
ruining my page. Are there any general rules in dealing with this
problem? Should I call maybe a "Response.Clear ()" from time to time
to keep it from happening, or sth like that. It's killing me. |
|
l*s 发帖数: 783 | 2 最近认真看了一下MVC1.0, 最重要的改变莫过于鄙弃了viewstate和postback. 作为推
出asp.net webform时的卖点之一,ViewState在应用中的确被验证了弊大于利。这算不
算是start from the wrong foot呢?结果现在匆忙推出MVC,几乎现有的control都一下
子不能用了(大多数基于viewstate),配套的control set又没有推出,导致从webform
转到mvc非常困难。 MVC现在有点像asp,在页面里嵌入server side code(helper
functions),让我觉得是step backward. 估计在MVC compatible control set出来之
前MVC不会取得成功 |
|
c*o 发帖数: 70 | 3 To the best of my knowledge, there are seven methods to pass parameters
between web forms. Session variable method is the one I used most frequently.
Any comments are warmly welcomed!
1. global variables in Gloable.asax
2. application variables: Application["username"]="peter"; //any type of data
3. session variables: Session["username"]="peter"; //any type of data
4. viewState variables: ViewState["username"]="peter"; //only String data type
can be used
5. Context: Context.Items["username"] = " |
|
k****i 发帖数: 1072 | 4 Each time a request comes,not matter it's a new request or postback,a new
application object will be created(or from application object pool).Postback
request only restore the info stored in the viewstate bag.So store ur profile
somewhere like session,application,viewstate,cache,cookie,hidden field and
retrieve it back.
to
But |
|
a9 发帖数: 21638 | 5 如果带宽没什么问题的话,用viewstate也可以。
datagrid就是用viewstate保存的。 |
|
h****z 发帖数: 2009 | 6 选了.Net.但实在是不喜欢.Net的viewstate加的那些垃圾。 |
|
|
|
|
g*******a 发帖数: 1383 | 10 【 以下文字转载自 Programming 讨论区 】
【 原文由 gogowanda 所发表 】
Hi all, this problem has been bothering me for a while and
i really need to get it done today. so seeking help here!
i'm using asp.net in windows XP, c#
i have a page consist two frames. when user click on the
image button of the right frame, i need to invoke the
postback on the left frame. so far i only can use java
script to refresh it, but then i lose all my viewstate
values. only a postback can preserve them. so how can i
"fake" a postback on |
|
z**u 发帖数: 3 | 11 Session uses too much resources when the server runs under load.
ViewState does not work well with different pages. As 1,2,3, it does not work
for different pages under different applications.
Server.Transfer has to transfer to the same application either.
Redirect works great, except the URL size has limitation(1K)
Cookies depend on browser support.
Next version of ASP.net will support it :)
frequently.
data
type
as
user |
|
k****i 发帖数: 1072 | 12
以
者
place to place state(cache,application,viewstate,form post/query
string,session,context,config file,cookie),Page object model,iis and asp.net
security architect,authentication and authorization(IPrinciple),HttpModule and
HttpHandler,etc.This is exactly what I need.Implementation detail is just
trivial for programmers now,we need to know how the whole things work
together.
got many good articles from msdn talking about these things. But if there is a
book talking about the things I want,I wi |
|
|
k****i 发帖数: 1072 | 14 R u sure?
data binding in pageload will overwrite the value retrieve from viewstate and
would cause the problem that julyan encountered.Unless you use !IsPostBack |
|
M******k 发帖数: 27573 | 15 en, i guess your solution is correct.
the re-initialize of dropdownlist in Page_Load
overwrite the viewstate, so he can't get selectedValue
in the event. |
|
p*p 发帖数: 75 | 16 你说得没错。
具体地说,是DropDownList 的 TrackViewState() 在第一个"before" item假如前还没有
被执行。
Page_Init
TrackViewState() called, 但这时候这个DropDownList还不存在。
Page_Load
ddlDynamic = new DropDownList()
ddlDynamic.Items.Add("before") - ddlDynamic的TrackViewState() not
called, 所以这时候加入的item没有被保存在ViewState里,postback后就丢失了
form1.Controls.Add(ddlDynamic); - 当一个Control加入到一个control hierachy
tree时,它的父节点会对他初始化,让这个Control及其子节点到达父节点的状态。因为
这时Page已经inited, 所以,Control_Init会执行,Control_TrackViewState() called.
ddlDyna |
|
j**o 发帖数: 4 | 17 Before the column is added to the grid, the grid should have been filled with
viewstate data. So adding a blank column with the same name would replace the
column already in there? I have to fire up the Reflector to confirm this. If
so, then the adding column operation should be moved inside the "if" block. |
|
b*e 发帖数: 3845 | 18 I guess it's a similar question that has something to do with viewstate.
PIP, you are so strong in .NET. What do you do for a living? |
|
s***d 发帖数: 14 | 19 Thanks again.
My problem is I don't know how to 'extract data from the control and save in
the object in memory' (step 4).
From what I've learned, in Page_Load (postback), I need re-create the DataGrid
first, and before any event handler is called, ASP.NET page handler tries to
match it with ViewState and also update with data just updated by the user, if
there's any.
There are a couples of problems:
1. Unlike other basic controls, DataGrid, however, doesn't have properties
like 'Text' or Select |
|
l*s 发帖数: 783 | 20 one good thing about Nikhil's Web Development Helper is that it has many asp
.net specific things like viewing the viewstate that other developer
toolbars do not provide. I haven't tried web developer extension for FF
though because our clients only use IE.
of |
|
l*s 发帖数: 783 | 21 What ajax library do you use?
If you are using server.transfer, use repsonse.redirect instead. |
|
D*****n 发帖数: 363 | 22
I'm using Infragistics WebAsyncRefreshPanel, it fires a weird
script + literal combo to do page transfer. It doesn't work well
with non-trivial load of web controls. |
|
k****i 发帖数: 1072 | 23 .net里还没有这么成熟的cache管理机制。
现成的cache大致有几方面:
1。Page level或Control level的cache.
可以在page/control header定义是否缓存;是否根据url的querystring的不同缓存不
同版本(或具体到某个parameter);自定义cache的criteria(如根据browser);缓存
时间;在那一级设备缓存。甚至还可以让数据的变动自动invalidate缓存(sql server
2005).
但程序员无法管理这些缓存的数据。
2。程序员可管理的各种server端和client端的缓存手段如Cache,session,cookie,
viewstate,etc.
3。Microsoft Enterprise Library的caching block.可以缓存到内存,磁盘甚至数据
库(provider model).
对于这种静态页面的生成和缓存,还没有现成的解决方案吧。 |
|
k****i 发帖数: 1072 | 24 Make sure the viewstate is enabled and the timing you tried to retrieve the
new value.
the
<
returned
content
so |
|
s***o 发帖数: 2191 | 25 just my two cents:
The idea behind ASP.NET MVC is good, especially for those people who believe
TDD is critical.
But, I think it came out a little too late, meanwhile it is not mature enoug
h . I would rather spend time on mastering Silverlight now.
BTW, I don't think viewstate is that bad, as long as it is used "properly". |
|
s***o 发帖数: 2191 | 26
说............................说
任务完成,展得够开吗?:)
////
(ok. just my personal opinions)
* With jQuery, you need tight control over the HTML. This is how MVC is
designed for while Web forms generates the who-knows-what markups for
you automatically. In .NET 4, one good thing is that you can control the
clientID generated in Web Forms in a predictable way, which makes things
a lot easier.
* With jQuery, you have to write a lot of HTML markups manually in any
way. This eliminates one big advantage of we... 阅读全帖 |
|
l*s 发帖数: 783 | 27 目前asp.net有两种web框架:传统的webforms和较新的Model-View-Controler(MVC).
MVC主要是把业务逻辑从aspx.cs中分离出来(为此加入了view enginee,routing
engine等,还有去掉了viewstate等很多改变),因此页面的写法和传统的webforms有
很大不同。选用webforms还是MVC纯属个人或公司选择。 |
|
p*********t 发帖数: 2690 | 28 asp.net c#编程,要用到viewState,session之类的,还有property之类的,和别的语
言还是有差别的。 |
|
|
W********n 发帖数: 254 | 30 MVC也有自己的问题,代码量比web form多些,没有拖拽的controls,你可以和VS的
design view完全说再见了,没有viewstate,所有的页面状态需要你自己考虑如何来回
传送,需要对jquery很熟悉,server side validation是完全静态的,当然最重要的是
有一个比较大的learning curve |
|
c*********e 发帖数: 16335 | 31 用viewstate? 也可以在转到第二个page的url里加上?param=xxx |
|
m******t 发帖数: 2416 | 32
That's what .Net does. You can put all the states in ViewState,
which is essentially an encrypted hidden field and gets carried
back and forth between requests.
But then, the keyword here is "encrypted". |
|
r*****l 发帖数: 2859 | 33 The viewstate is not encrypted, it's just base-64(?) coded.
It's easy to do it in java too. |
|
x**n 发帖数: 461 | 34 ViewState 好像不是一个好的选择,他只是简单加密过的一个field而已,而且server
has full access to view state. |
|