473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

seesion cookie question.

We are having a web application which spans across multiple domains.
Iam trying to synchronize session information between the two domains.
If I know the value of ASP.NET_SessionId cookie, can I use a
HttpWebRequest class to send a request to the other domain with the
ASP.NET_SessionId cookie in it, and make ASP.Net think that this is the
same session Request ? ( i would be passing other credentials to secure it )

This is what i tried ( this is not working though !)

Dim myRequest As HttpWebRequest =
HttpWebRequest.Create("http://localhost/MyOtherSite/synchronize.aspx")
Dim mySessionCookie As New Cookie("ASP.NET_SessionId",
"fbo0sd55risyn245gfgunt45", "/")

mySessionCookie.Domain = "http://localhost/MyOtherSite/"

myRequest.CookieContainer = New CookieContainer

myRequest.CookieContainer.Add(mySessionCookie)

Dim myResponse As HttpWebResponse = myRequest.GetResponse

Dim myStream As IO.Stream = myResponse.GetResponseStream

Catch ex As Net.WebException
MessageBox.Show(ex.ToString)
End Try
any help or pointers would be appreciated

thanks
-ashish
Nov 19 '05 #1
2 1505
If I understand you correctly you may just need to share the cookie. If both
of your sites are on the same domain you can share a cookie between machines
by explicitly setting the cookie.domain = <.mydomain.com>.

Hope this helps.

"ashish" wrote:
We are having a web application which spans across multiple domains.
Iam trying to synchronize session information between the two domains.
If I know the value of ASP.NET_SessionId cookie, can I use a
HttpWebRequest class to send a request to the other domain with the
ASP.NET_SessionId cookie in it, and make ASP.Net think that this is the
same session Request ? ( i would be passing other credentials to secure it )

This is what i tried ( this is not working though !)

Dim myRequest As HttpWebRequest =
HttpWebRequest.Create("http://localhost/MyOtherSite/synchronize.aspx")
Dim mySessionCookie As New Cookie("ASP.NET_SessionId",
"fbo0sd55risyn245gfgunt45", "/")

mySessionCookie.Domain = "http://localhost/MyOtherSite/"

myRequest.CookieContainer = New CookieContainer

myRequest.CookieContainer.Add(mySessionCookie)

Dim myResponse As HttpWebResponse = myRequest.GetResponse

Dim myStream As IO.Stream = myResponse.GetResponseStream

Catch ex As Net.WebException
MessageBox.Show(ex.ToString)
End Try
any help or pointers would be appreciated

thanks
-ashish

Nov 19 '05 #2
Hi ENIZIN ,
thanks for the response

what i would really like to do is to send a request to the other domain
using HTTPWebRequest class, and i want the other domain to associate
this request with the session i want it to ..

this way i would be able to control session variables on the other
domain without explicity redirecting user to it.

regards
-ashish

ENIZIN wrote:
If I understand you correctly you may just need to share the cookie. If both
of your sites are on the same domain you can share a cookie between machines
by explicitly setting the cookie.domain = <.mydomain.com>.

Hope this helps.

"ashish" wrote:

We are having a web application which spans across multiple domains.
Iam trying to synchronize session information between the two domains.
If I know the value of ASP.NET_SessionId cookie, can I use a
HttpWebRequest class to send a request to the other domain with the
ASP.NET_SessionId cookie in it, and make ASP.Net think that this is the
same session Request ? ( i would be passing other credentials to secure it )

This is what i tried ( this is not working though !)

Dim myRequest As HttpWebRequest =
HttpWebRequest.Create("http://localhost/MyOtherSite/synchronize.aspx")
Dim mySessionCookie As New Cookie("ASP.NET_SessionId",
"fbo0sd55risyn245gfgunt45", "/")

mySessionCookie.Domain = "http://localhost/MyOtherSite/"

myRequest.CookieContainer = New CookieContainer

myRequest.CookieContainer.Add(mySessionCookie)

Dim myResponse As HttpWebResponse = myRequest.GetResponse

Dim myStream As IO.Stream = myResponse.GetResponseStream

Catch ex As Net.WebException
MessageBox.Show(ex.ToString)
End Try
any help or pointers would be appreciated

thanks
-ashish

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ralph Freshour | last post by:
I wrote a small .php script that creates a cookie on my local PC - I also wrote one that deletes it. My question is this: when the cookie has been created and I run the delete .php script, when...
6
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
1
by: Display Name | last post by:
Used one of these canned scripts to set up a JS quiz but not before having used another canned PHP script for "Tell your friend about this Web page!" sort of thing. Now i've gotta integrate them;...
7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
15
by: Oleg Leikin | last post by:
Hi, (newbie question) I've created some simple .NET ASP application that should store cookies at the client machine. According to the documentation cookie expiration time is set via...
3
by: Dan | last post by:
Hi, I am trying to refresh the cookie to make sure the timeout is reset by simply calling a blank page on my site. I am doing this because I have an external site hosted in my web that isn't...
3
by: smartic | last post by:
i want to make the user to remind on my site. how can i do that with session or cookie like in this forum when i check the remember box ? and how can i secure cookie or session? what i will store...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.