连接到会话 [英] Connect to session

查看:79
本文介绍了连接到会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

如果我有SessionID

(或我能提供的任何东西),我如何加入会话或读取会话变量?


想象一下,我的网页上有一个外部链接,它会打开一个应用程序

,它可以向服务器发出请求。它开始另一个会话,

但我需要使用浏览器中的会话。

链接我能够发送服务器可以给我的任何属性。


谢谢,Jan。

Hi.
How can I join session or read Session variables if I have the SessionID
(or anything what I can supply)?

Imagine I have a external link from my webpages, which opens an application
which is expected to make requests to the server. It starts another session,
but I need to use the session from browser.
To the link I''m able to send any property the server can give me.

Thanks, Jan.

推荐答案

你说的多么混乱!!!

你能简单得到你需要的东西吗?


如果你有网站A和网站B,如果不是在同一台服务器上他们将会b / b
有不同的会话(即使使用相同的名称)


从网站A发送信息到网站B使用POST或GET和他们

使用值填充新网站。


例子从网站A发送会话(名称)和会话(用户名)到

网站B

网站A


session(" name")=" Bruno"

session(" username")=" balexandre"


如果您使用GET方法,则打开新网站B的链接应为l这个

www.domainB.com/websiteBpage.aspx?un= &会话(用户名)& "&安培; N =" &

session(name)


在网站B中使用QueryString方法填充会话


session(" name")= request.querystring(" n")

session(" username")= request.querystring(" un")

>
-


Bruno Alexandre

(丹麦葡萄牙语)


" Jan Kucera的" < ua*@centrum.cz> escreveu na mensagem

新闻:e1 ************* @ TK2MSFTNGP05.phx.gbl ...
what a confusion you said !!!
can you simplefy what you need?

if you have website A and website B, if not in the same server they will
have diferent sessions (even if using the same name)

to send info from website A to website B use the POST or GET and them
populate the new website with the values.

example to send session("name") and session("username") from website A to
website B
website A

session("name") = "Bruno"
session("username") = "balexandre"

the link to open the new website B if you''re using GET method sould be like
this

www.domainB.com/websiteBpage.aspx?un= & session("username") & "&n=" &
session("name")

in website B populate the sessions using the QueryString method

session("name") = request.querystring("n")
session("username") = request.querystring("un")

--

Bruno Alexandre
(a Portuguese in Denmark)

"Jan Kucera" <ua*@centrum.cz> escreveu na mensagem
news:e1*************@TK2MSFTNGP05.phx.gbl...
嗨。
如果我有SessionID
(或我可以提供的任何东西),我如何加入会话或读取会话变量?

想象一下,我的网页上有一个外部链接,可以打开一个
应用程序,它应该向服务器发出请求。它开始了另一个会话,但我需要使用浏览器中的会话。
链接我能够发送服务器可以给我的任何属性。

谢谢,Jan。
Hi.
How can I join session or read Session variables if I have the SessionID
(or anything what I can supply)?

Imagine I have a external link from my webpages, which opens an
application which is expected to make requests to the server. It starts
another session, but I need to use the session from browser.
To the link I''m able to send any property the server can give me.

Thanks, Jan.



对不起,如果我对你造成了很大的困惑! :-)


所以首先,我只有一个网站。我将用我所拥有的实际情况做出具体的例子,我只是认为这会使一切变得复杂。


用户使用Windows身份验证登录到网络。在网上,他打开了一个

项目。每个用户在其Session中都有CurrentProject变量。

现在,在某些页面上,有一个Word文档的链接。 Word文档打开

和 - 使用宏 - 即将从

Web服务器上的CurrentProject更新其内容。

我有处理程序/发布的Web服务将值返回给文档,用于

示例 http:// MYSERVER / getcontent.ashx 。然而,Word开始新的会话

及其请求。


就是这样。在处理程序中,我需要获取CurrentProject,但我没有
有用户登录的会话。


我以为我可以发送我不知道,例如。 SessionID,所以Word可以为 http://询问

myserver / getcontent.ashx?SessionID = id
,在服务器端,我

可以获得正确的会话及其CurrentProject。


我无法控制Word中的请求流(因此标题)。


这有点清楚吗?

Jan
Okay sorry if I made a big confusion to you ! :-)

So. Firstly I have only one site. I will make concrete examples with the
real situation I have, I just thought it will complicate everything.

User logs into the web using Windows authentication. On the web, he opens a
project. Each user has CurrentProject variable in his Session.
Now, on some page, there is link to a Word document. The Word document opens
and -using macro- is about to update its content from CurrentProject at the
web server.
I have handler/web service published to return values to the document, for
example http://myserver/getcontent.ashx. However, Word starts new session
with its request.

And thats it. At the handler I need to get the CurrentProject but I don''t
have the session into which the user logged in.

I thought that I could send I don''t know eg. SessionID, so the Word can ask
for http://myserver/getcontent.ashx?SessionID=id, and on the server side, I
can get the proper session and its CurrentProject.

I have no control of the request stream (thus headers) from the Word.

Is that somewhat clearer?
Jan


你好Jan,


Word将始终像新客户端一样,因此将开始新的

会话。我不太确定你是否可以重新使用某个会话,或者你可以想象它是否是b $ b,但这是一个解决方法:


在数据库中创建会话表。这样,当用户登录时,您可以做的是

,您可以在数据库中输入会话(以及

相关变量)。现在您可以将SessionID

或UserID传递给您的word文档,该文档可以通过其宏传递给网站

服务。然后,Web服务可以从数据库中重新创建

会话。


我希望有所帮助。


问候,

Vaibhav

Hi Jan,

Word will always act like a new client and hence will start a new
session. I am not too sure if you can re-use a session in teh way that
you are visualizing it or not, but here is a work around:

Create a session table in the database. This way, what you can do is
when a user logs in, you can make an entry of the session (and
associated variables) in the database. Now you can pass the SessionID
or the UserID to your word document, which can pass it on to the web
service through its macro. The web service can then recreate the
session from the database.

I hope that helped.

Regards,
Vaibhav


这篇关于连接到会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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