Ok so it logs in fine using

public bool Login()
        {
            string postdata = string.Format("m=login&nextURL=http%3A%2F%2Fwww.ijji.com%2Findex.nhn&memberid={0}&password={1}", encode(Username), encode(Password));
            string result = post(_url + "login.nhn", postdata);
            return !(result.Contains("You have entered an incorrect password") || result.Contains("User ID is not found"));
        }
        public string GetCookies() { return Cookies.GetCookieHeader(new Uri("http://ijji.com/")); }

then it when trying to get the cookies to an inside browser it errors

if (Logins.Login())
                {
                    IDC_Browse.Navigate("javascript:cookie=\"" + Logins.GetCookies() + "\";"); // <-- that line
                    IDC_Browse.Navigate("javascript:goPlay('u_gunz', '');");
                }

the Logins.GetCookies(); is returning a null reference.

"NullReferenceException was caught"
"Object reference not set to an instance of an object."

Basically - i need it to store the cookies from the login and ship them into the C# web browser control then run that second lot of javascript :)

Any ideas?

Recommended Answers

All 8 Replies

But its not the same instance.. So, its not going to have the same cookies. You would need to grab and set the cookies at the time you login

But its not the same instance.. So, its not going to have the same cookies. You would need to grab and set the cookies at the time you login

how?

Set the cookie when you make the login call..

Set the cookie when you make the login call..

yeah............ I don't understand :(

Thats obvious.
Did you cut and paste the code you have? You have a login function, you need to collect the cookies and store them within the login function..

Thats obvious.
Did you cut and paste the code you have? You have a login function, you need to collect the cookies and store them within the login function..

ive only been coding in C# for around a month so i have no idea about cookies

cookies are not a c# thing, but a web thing.

cookies are not a c# thing, but a web thing.

yes what i meant is i have no idea how to keep them from the login and inject them into the webbrowser control so i can from there
execute javascript

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.