I want to write comments with cookie authentification.
My code c#:
serverURL = "http://www.livejournal.com/interface/xmlrpc";
public string WriteComment(string serverURL, string userName, string password)
{
try
{
if (serverInterface == null)
serverInterface = Create(serverUrl);
if (!ChallengeResponse(password))
throw new Exception(Strings.GetPostException1);
SessionGenerateParams sgp = new SessionGenerateParams(userName, "challenge", authChallenge,authResponse, 1, "long", 1);
SessionGenerateResponse sgr = serverInterface.SessionGenerate(sgp);
Uri uri = new Uri("http://kazanuda.livejournal.com/121737.html?mode=reply");
HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create(uri.AbsoluteUri);
hwr.ProtocolVersion = new Version(1, 0);
hwr.KeepAlive = false;
CookieCollection c = new CookieCollection();
c.Add(new Cookie("ljsession", sgr.ljsession, "/", "www.livejournal.com"));
hwr.CookieContainer = new CookieContainer();
hwr.CookieContainer.Add(c);
hwr.Headers.Add("X-LJ-Auth", "cookie");
WebResponse wr = hwr.GetResponse();
Stream s = wr.GetResponseStream();
StreamReader r = new StreamReader(s);
//in htmlStr contain HTML where i not autorized :-(
string htmlStr = r.ReadToEnd();
}
catch (Exception e)
{
throw e;
}
}
I want that htmlStr contain html with my autorization.
How can i do it??
HELP ME!!:)
Sorry for my bad english...