在asp.net中将变量值从一页发送到另一页的不同方法 [英] diffrent ways iof sending variable values from one page to another page in asp.net

查看:50
本文介绍了在asp.net中将变量值从一页发送到另一页的不同方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个问题,例如由于平衡负载,我已经在多个Web服务器中部署了asp.net应用程序.因为如果一台服务器被加载,负载均衡器会将请求传递给另一台Web服务器,那么客户端将很高兴

在此方法中,例如:客户端在请求page2.aspx之后向Web服务器1请求page1.aspx,但是加载了web server1,因此负载均衡器将请求传递给另一个Web server2并服务该请求

在这个问题中,我选择了会话变量.我可以知道如何从一台Web服务器获取会话变量值到另一台Web服务器吗?如果不可能,您能否指导我,这是在页面之间传递值的最佳方法?

suppose i have a senario like i have deployed my asp.net application in multiple web servers due to balance the load. because if one server gets loaded the load balancer will passes the request to another web server there by client will be happy

in this senario say for ex: client requests page1.aspx for web server1 after that client request for page2.aspx but web server1 gets loaded so load balancer passes the request to another web server2 and serve the request

in this senario i choosed session variables. may i know how to get session variable value from one web server to another webserver? if its not possible can u guide me which is best way of passing values between pages

推荐答案

我不完全理解您的要求,但是我认为您正在寻找一个Web应用程序的负载平衡. Google提供了用于负载平衡的硬件/软件.

这是有关WebGarden的链接,请参考.
http://iisadmins.blogspot.com/2011/04/difference- between-web-farm-and-web.html [ ^ ]

谢谢
--RA
I am not Completely understood your requirement, But i think your are looking for a load balancing for your web application. There are Hardware/Software available for the load balancing, Google it.

Here is the link for you about the WebGarden, please refer this.
http://iisadmins.blogspot.com/2011/04/difference-between-web-farm-and-web.html[^]

Thanks
--RA


我认为您应该使用Session(会话状态服务器或Session-SQLServer)将Web应用程序托管在WebGarden或webfarm中.或任何其他客户端状态管理(如Cookie).
I think you should use Session (Session-StateServer or Session-SQLServer) for web application is hosted in WebGarden or webfarm . or any other Client side State management like cookies.
Configuration: For StateServer
<sessionstate>
    mode="InProc"
    stateConnectionString="tcpip=127.0.0.1:42424"
    sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
    cookieless="false" 
    timeout="20" /> </sessionstate>


Configuration: SQL Server
<sessionstate mode="SQLServer" sqlconnectionstring="..." /> 



供参考
初学者入门中的状态管理技术ASP.NET [ ^ ]
ASP.NET会话管理内部 [



For reference
Beginners Introduction to State Management Techniques in ASP.NET[^]
ASP.NET Session Management Internals[^]

Thanks
Akash Detroja


1.如果您使用的是inproc 会话(会话信息在Web服务器内存中时)[此为DEFAULT]

您将必须使用支持connection affinitysticky sessions的负载平衡.这样负载平衡器将始终将来自客户端的请求转发到同一服务器.

2.如果您正在使用outporc 会话,即sqlserver stateserver 用于会话管理.

这样可以很好地处理一切.您将需要单独的服务器和显式配置来执行此操作.此外,您还需要确保会话中输入的所有值都可序列化.

但是我猜您正在使用第一种方式.因此,我建议检查您的负载均衡器以对粘性会话使用连接亲缘关系.那是唯一的营救方法.并且您最初要求的内容不是会话处理的inproc/default方式.
1. If you are using inproc session (when session info is in web servers memory) [THIS IS THE DEFAULT]

You will have to use a load balance that support connection affinity to sticky sessions. so that the load balancer will always forward request from a client to same server.

2. if you are using outporc session i.e. sqlserver or stateserver for session management.

This will take care of everything just fine. you will be needing a separate server and explicit configuration to do this. also you need to make sure that all the values you are putting in session are all serializable.

But i am guessing you are using the first way. so i suggest, check your load balancer to use connection affinity to sticky sessions. that is the only rescue. and what you asked for in the first place is not possible for inproc/default way of session handling.


这篇关于在asp.net中将变量值从一页发送到另一页的不同方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆