Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 10, 2012 08:43 AM by Richey
None
0 Points
36 Posts
Apr 04, 2012 01:12 PM|LINK
Hi
Ex :
test1.com
test2.com
once i loaded test1.com in my browser and in the browser another tab if i open test2.com , i have to get some session / cookie values from test1.com
or
i have to check in the test2.com ( another tab) , test1.com is already opened or not in asp.net with C#.
Pease guide us for the above sceanario.
Thanks & Regards,
Visa.G
Apr 04, 2012 02:06 PM|LINK
I got a solution for this
Below is the answer :-
test1.com/default.aspx.cs
protected void Page_Load(object sender, EventArgs e) { HttpCookie myCookie = new HttpCookie("TestCookie"); myCookie.Domain = ".test1.com"; myCookie["msg"] = "Welcome from Cookie"; Response.Cookies.Add(myCookie); }
test2.com/Default.aspx.cs
HttpCookie cookie = Request.Cookies["TestCookie"]; if (cookie != null) { Response.Write(cookie["msg"]); } else { Response.Write("FAILED"); }
Contributor
3816 Points
431 Posts
Apr 10, 2012 08:43 AM|LINK
HI,
Thanks for sharing your answer.
Visalakshi_B...
None
0 Points
36 Posts
Cross Domain Check
Apr 04, 2012 01:12 PM|LINK
Hi
Ex :
test1.com
test2.com
once i loaded test1.com in my browser and in the browser another tab if i open test2.com , i have to get some session / cookie values from test1.com
or
i have to check in the test2.com ( another tab) , test1.com is already opened or not in asp.net with C#.
Pease guide us for the above sceanario.
Thanks & Regards,
Visa.G
Visalakshi_B...
None
0 Points
36 Posts
Re: Cross Domain Check
Apr 04, 2012 02:06 PM|LINK
Hi
I got a solution for this
Below is the answer :-
test1.com/default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie myCookie = new HttpCookie("TestCookie");
myCookie.Domain = ".test1.com";
myCookie["msg"] = "Welcome from Cookie";
Response.Cookies.Add(myCookie);
}
test2.com/Default.aspx.cs
HttpCookie cookie = Request.Cookies["TestCookie"];
if (cookie != null)
{
Response.Write(cookie["msg"]);
}
else
{
Response.Write("FAILED");
}
Richey
Contributor
3816 Points
431 Posts
Re: Cross Domain Check
Apr 10, 2012 08:43 AM|LINK
HI,
Thanks for sharing your answer.