473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cookie and auto login web page question

I have encountered a problem when I try to visit a web page (like
http://www.xxx.org....?arg1=x&arg2=x&....) using HttpWebRequest and
HttpWebResponse and related methods .NET provides.The code is like this:
....
HttpWebRequest r = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse rp = r.GetResponse();
....

However,I've got the error page that is redirected to by the page I
request.And the response page says that "you have no permission to visit this
page.Please login first!".So,I find the login page (like
http://www.xxx.org/login.asp") and get the form fields such as username and
password.Then,I request the login page using method POST like :
....
string postData = "username=myusername&password=mypassword&...";
byte[] data = Encoding.ASCII.GetBytes(postData);
HttpWebRequest rlogin = (HttpWebRequest)WebRequest.Create(login_url);
rlogin.Method = "POST";
rlogin.ContentType = "application/x-form-un....";
Stream loginStream = rlogin.GetRequestStream();
rlogin.ContentLength = data.Length;
loginStream.Write(data,0,data.Length);
HttpWebResponse rplogin = rlogin.GetResponse();
....
The response page tells me that login successfully.Then,I try to request the
original page again,however,the permission error occurs once again.
How can I solve such problem?
I noticed that the web site has stored cookie information on my
computer,because when I directly request the web page in Internet Exporer,I
can get the correct web page.Thus,How to access the cookie and associate it
to the HttpWebRequest in my application?

Thanks.
Nov 16 '05 #1
0 2456

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shabam | last post by:
I'm developing an application and want to have the "remember me" feature, so that users don't have to log back in again in the next visit. The problem here is, what happens if the user's cookie...
0
by: Peter Row | last post by:
Hi, I have a legacy VB6 webclass app that has been directly ported to VB.NET. My .NET webclass infrastructure works in more or less the same way but is now specific to my app and not the...
4
by: 23s | last post by:
I had this problem in the past, after a server reformat it went away, and now after another server reformat it's back again - no clue what's doing it. Here's the flow: Website root is public, no...
4
by: craigkenisston | last post by:
I have an asp.net application in which I sometimes store a persistent cookie once the user has logged in and this has been working great. However, I now add some user information like, username,...
1
by: .NET Developer | last post by:
I'm having an issue that hopefully someone here can help me out with. First a quick explanation: I'm managing users of my site in a fairly custom way. (in other words I'm not using asp.net's...
15
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok....
2
by: rn5a | last post by:
A web.config file has the following code: <configuration> <system.web> <authentication mode="Forms"> <forms name="NETConnectCookie" loginUrl="Login.aspx"> <credentials passwordFormat="SHA1"/>...
7
by: monomaniac21 | last post by:
hi i have a php site which allows users to save a cookie on their computer which stores their user id details and allows them to auto- login. i'm wondering whether this is safe, is it...
1
by: vj83 | last post by:
Hi, Iam working in a webapplication in which I am using RSA cookie authentication to login. I login using secure RSA ID in which i login using different users with different Tokens such as Admin ,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.