TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
satish_talreja
NA
12
0
Unable to POST using HTTPWebRequest
Jun 22 2004 10:59 AM
Hello All I have given below the code snippet of the HttpWebRequest that I am sending to the login page. The login.asp is the login page but it is ALSO the page where the login validation occurs. Now my problem is that using C# I am unable to login and go to the next page but I am able to do this using XMLHTTP in ASP. The application remains at the same page and retrieves the HTML of that page only. For now I have only included the request part of my code. Any help is greatly appreciated. I did try using the code posted in a very old post in this forum but even that did not work. Regards Satish CODE ASCIIEncoding encoding = new ASCIIEncoding(); string strPost = "submit=Login&userid=abc&passwd=abcd"; byte[] data = encoding.GetBytes(strPost); HttpWebRequest myHttpWebRequest1 = (HttpWebRequest)WebRequest.Create("http://localhost/login.asp"); myHttpWebRequest1.Method = "POST"; myHttpWebRequest1.ContentType = "application/x-www-form-urlencoded"; myHttpWebRequest1.ContentLength = data.Length; Stream newStream = myHttpWebRequest1.GetRequestStream(); newStream.Write(data,0,data.Length); newStream.Close();
Reply
Answers (
0
)
Why won't my datagrid appear?
Create a PDF VB.NET