hi everyone
I'm trying to login in secure site. nike.net. from my windows application.
I am using vb.net. I'm able to catch all the cookies and headers from firtst httpwebresponse.
but when i'm trying to login (i used both webclient and httpwebrequest) i'm getting "System.Net.WebException = {"The remote server returned an error: (500) Internal Server Error."}"
error. I cannnot move forward from here. I tried to deal with credentials. didn't work either.
all cookies and headers i picked up from previous httpwebresponse. i also checked it with httpanalyzer and everything seems right.
may be i'm not using right credentials.
login and password is changed, but if code works we supposed to get the same page with bad login message, but not webexception i'm getting now.
below is the code i'm using. Thank you very much.
sURL = "https://www.nike.net/portal/site/nike/index.jsp?epi-content=LOGIN&epi-process=process_login.jsp"
cookie1 = "b2rTest=; vap_JSESSIONID=FaCo5NAKKlD053eWGdii1qNGMWCtTE2LGx3ofb7V0KFaxdmw4Y80!-1263957463!-71976742"
c.Add(New Cookie("b2rTest", "", "/", ".nike.net"))
Dim postData As String
WebReq = WebRequest.Create(sURL)
WebReq.Referer = "https://www.nike.net/portal/site/nike/index.jsp?epi-content=LOGIN"
WebReq.ContentType = "application/x-www-form-urlencoded"
WebReq.Headers.Add("Cache-Control", "no-cache")
WebReq.CookieContainer = New CookieContainer
WebReq.CookieContainer.Add(c)
WebReq.AllowAutoRedirect = False
WebReq.Headers.Add("UA-CPU", "x86")
WebReq.Method = "POST"
WebReq.Accept = "*/*"
WebReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
WebReq.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-us")
WebReq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate")
WebReq.KeepAlive = True
WebReq.Headers.Add("Cookie", cookie1)
Dim data() As Byte
postData = "lang=null&logon=xxxxxx@xxx.com&password=xxxxx&submit_logon=Submit&changeLanguageSelect=en&realm=realm1"
data = ASCIIEncoding.ASCII.GetBytes(HttpUtility.UrlEncode(postData))
WebReq.ContentLength = data.Length
myStream = WebReq.GetRequestStream()
myStream.Write(data, 0, data.Length)
myStream.Close()
WebReq.Credentials = New NetworkCredential("xxxxxx@xxx.com", "xxxxx", www.nike.net)
WebRes = WebReq.GetResponse ' this line throws me System.Net.WebException
sr = New StreamReader(WebRes.GetResponseStream)
strHTML = sr.ReadToEnd
I'm trying to login in secure site. nike.net. from my windows application.
I am using vb.net. I'm able to catch all the cookies and headers from firtst httpwebresponse.
but when i'm trying to login (i used both webclient and httpwebrequest) i'm getting "System.Net.WebException = {"The remote server returned an error: (500) Internal Server Error."}"
error. I cannnot move forward from here. I tried to deal with credentials. didn't work either.
all cookies and headers i picked up from previous httpwebresponse. i also checked it with httpanalyzer and everything seems right.
may be i'm not using right credentials.
login and password is changed, but if code works we supposed to get the same page with bad login message, but not webexception i'm getting now.
below is the code i'm using. Thank you very much.
sURL = "https://www.nike.net/portal/site/nike/index.jsp?epi-content=LOGIN&epi-process=process_login.jsp"
cookie1 = "b2rTest=; vap_JSESSIONID=FaCo5NAKKlD053eWGdii1qNGMWCtTE2LGx3ofb7V0KFaxdmw4Y80!-1263957463!-71976742"
c.Add(New Cookie("b2rTest", "", "/", ".nike.net"))
Dim postData As String
WebReq = WebRequest.Create(sURL)
WebReq.Referer = "https://www.nike.net/portal/site/nike/index.jsp?epi-content=LOGIN"
WebReq.ContentType = "application/x-www-form-urlencoded"
WebReq.Headers.Add("Cache-Control", "no-cache")
WebReq.CookieContainer = New CookieContainer
WebReq.CookieContainer.Add(c)
WebReq.AllowAutoRedirect = False
WebReq.Headers.Add("UA-CPU", "x86")
WebReq.Method = "POST"
WebReq.Accept = "*/*"
WebReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
WebReq.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-us")
WebReq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate")
WebReq.KeepAlive = True
WebReq.Headers.Add("Cookie", cookie1)
Dim data() As Byte
postData = "lang=null&logon=xxxxxx@xxx.com&password=xxxxx&submit_logon=Submit&changeLanguageSelect=en&realm=realm1"
data = ASCIIEncoding.ASCII.GetBytes(HttpUtility.UrlEncode(postData))
WebReq.ContentLength = data.Length
myStream = WebReq.GetRequestStream()
myStream.Write(data, 0, data.Length)
myStream.Close()
WebReq.Credentials = New NetworkCredential("xxxxxx@xxx.com", "xxxxx", www.nike.net)
WebRes = WebReq.GetResponse ' this line throws me System.Net.WebException
sr = New StreamReader(WebRes.GetResponseStream)
strHTML = sr.ReadToEnd