Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
i want to navigate from one website to another
ie,
if the following is my current page
http://www.eggheadcafe.com/ForumPostSubmission.aspx
i want to navigate to the following in a linkbutton Click
http://aspdotnetcode.source-of-humor.com/Articles/Cookies/UsingCookiesInASPNet-ReadWriteDeleteCookies.aspx
if the second one having a login,then what can i do to implement this.
ie it needs id,staffname,company,level to get in..........
I used the following way
HttpCookie ID = new HttpCookie("id");
                ID.Value = opjn.stringEncode("136");
                Response.Cookies.Add(ID);
                HttpCookie STAFFNAME = new HttpCookie("staffname");
                STAFFNAME.Value = opjn.stringEncode("Johnny");
                Response.Cookies.Add(STAFFNAME);
                HttpCookie LEVEL = new HttpCookie("level");
                LEVEL.Value = opjn.stringEncode("3");
                Response.Cookies.Add(ID);
                HttpCookie COMPANY = new HttpCookie("company");
                COMPANY.Value = opjn.stringEncode("54");
                Response.Cookies.Add(ID);

Response.Redirect(ConfigurationManager.AppSettings["Portal"] + "/aspdotnetcode.source-of-humor.com/Articles/Cookies/UsingCookiesInASPNet-ReadWriteDeleteCookies.aspx", false);

Its not setting cookies properly
Forms Authentication is used for the second website login


Please help me
Posted
Updated 26-May-11 0:34am
v2
Comments
cuteband 24-May-11 23:48pm    
You mean that your login is in different web application then if the login successful it will redirect you in different website?
kishore Rajendran 26-May-11 6:47am    
yes
Be Yourself 25-May-11 1:02am    
I think you can retrive the cookie by
response.getCookies() which returns the array of Cookie objects from which you can retrive your cookie by the ID value.
If U dont have the ID value you can always get it by setting it to the session attribute or response attribute.

1 solution

First, I guess it is just your example that adds ID cookie multiple times instead of LEVEL and COMPANY, not real code? Second, consider using HttpCookie.Domain property (maybe Path property as well) to set domain for which cookie is valid. Otherwise current domain and path are used
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900