| | |
CookieContainer Returning NULL
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 99
Reputation:
Solved Threads: 1
Ok so it logs in fine using
then it when trying to get the cookies to an inside browser it errors
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?
C# Syntax (Toggle Plain Text)
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
c# Syntax (Toggle Plain Text)
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?
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
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
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
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..
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..
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
![]() |
Other Threads in the C# Forum
- Previous Thread: Updating StreamReader
- Next Thread: how to refer the external file to my c# object
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






