473,785 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cre ate(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=myuse rname&password= mypassword&..." ;
byte[] data = Encoding.ASCII. GetBytes(postDa ta);
HttpWebRequest rlogin = (HttpWebRequest )WebRequest.Cre ate(login_url);
rlogin.Method = "POST";
rlogin.ContentT ype = "applicatio n/x-form-un....";
Stream loginStream = rlogin.GetReque stStream();
rlogin.ContentL ength = data.Length;
loginStream.Wri te(data,0,data. Length);
HttpWebResponse rplogin = rlogin.GetRespo nse();
....
The response page tells me that login successfully.Th en,I try to request the
original page again,however,t he permission error occurs once again.
How can I solve such problem?
I noticed that the web site has stored cookie information on my
computer,becaus e 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 2480

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

Similar topics

4
1532
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 is stolen? Or, what prevents someone from figuring out the algorithm to the cookie session string? I've thought of using a random string (stored in the database) that's written to the user's cookie once he's logged in. Since it's random there...
0
942
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 generic like the original MS version. This is all implemented in 1 DLL using a series of HttpHandlers and HttpModules. Anyhow, I need to do manual authentication ticket handling, which in this case I use an MD5 hash for.
4
5645
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 SSL no forms auth. One of the subfolders in the public area is the root of a "protected" area; SSL is required from this subfolder on forward and a web.config in the subfolder specifies forms authentication. From the public area, I provide a...
4
3157
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, firstname, lastname, etc. in the session collection and this works fine, but only the first time the user loggin. But, when the user returns I just get nil errors, because this data is lost. So, I guess, I'm missing something like auto-logging the...
1
1612
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 built-in methods). I have my own database table for user info, and people can register on the site, and then log in. If they haven't logged in, they are considered a guest and I store their name as "guest" in a sessions table along with some other info...
15
2145
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. I have a time-out of one minute and indeed, it directs me to the login if i wait to long. The slidingExpiration does it's work also.
2
2711
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"/> </forms> </authentication> </system.web>
7
4280
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 possible for a malicious user to find that cookie and change its value and therefore auto-login as someone else? and if so how can this be prevented?
1
1814
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 , client etc.., for ex.. if i login using Admin account and RSA pincode i have to redirect to a different destination page than that of the client account's destination page. The thing is that i have written RSA secured Cookie for login in a page...
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.