.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

C# Cookie Login Screen Scraper

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :.NET Framework
Hi guys, I'm trying to buffen up my C# knowledge and experience so I am converting a Python script I wrote to C#. The script converts and stores the user's browser cookies into a text file. It then uses them to log into a website that uses WLID login stores the new live.com cookies and the websites own user cookies; then scrapping the source of the HTML page. I've done some research and c#.net seems to have a lot of different ways to achieve a cookie login. What's the best way to achieve this in the simplest form? To clarify: I'm getting existing cookies from a web browsers cookie file and using those cookies to login to a site and then storing the new cookies. Here's my  basic request: using System; using System.Net; using System.IO; public class Test { public static void Main() { WebClient client = new WebClient(); client.Headers.Add("user-agent" , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" ); Stream data = client.OpenRead("http://www.google.com" ); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); Console.WriteLine(s); data.Close(); reader.Close(); } }  

View Complete Post

More Related Resource Links

UrlAuthorizationModule from login page screen

Hi All,I am new in ASP.NET, i need to learn how i can perform the windows login using custom made login form?For the example i have page login.aspx where i have textbox control for UserName and Password. and our Intranet client need to put his Username and Password and click Login button. the credential should be check against the windows basse authorization. If correct he will be redirected to the main page according to the roles defined in his windows account.I will appriciate for link of tutorial or easy way to do this job.Thank You,

Catch when user login cookie has expired. How to?



I have an ASP.NET MVC application that uses the Forms Authentication. I have the following configuration block inside the Web.Config:

<authentication mode="Forms">
  <forms loginUrl="~/Login/LogOn" name=".td_gsl_login_cookie" timeout="10" slidingExpiration="true" />

So if the user does not click any link for 10 minutes it will be disconnected and redirected to the LogOn action at the next click. This works very fine in my app.

Now what is really annoying is that I have some links in my app that open up a modal popup window (using jQuery UI) who retrieves their content dinamically using ajax requests and if the user click on one of these links after his login timeout has expired the result is that the login page is showed inside the popup dialog. The effect is really bad...

I understand that developing a script to check if the user is still connected would slide the cookie expiration.

Do you have any suggestion on how to address this behaviour?

thanks for helping






How to avoid login screen during debugging - SharePoint Development

We are doing SharePoint development on our virtual server (Win 2003) installed on Vista Business edition. During development, very time we run our ASP.NET application it asks for windows login and password despite the fact that we have commented out <authentication mode="Windows"/> in the web.config file.
How can we bypass this login screen?

SQL Server Login Screen


I'm trying to improve a progam handed off to me.

It is an Excel spreadsheet that retrieves data from SQL Server 2005.  I have the connection string in VBA.

When the code is executed it displays the login screen.  All the user does, is select OK and the data is returned.

This "extra click" is driving the user crazy.  How do I bypass display of this screen?  



LogIn control: How can i set password from cookie to login contro's password textbox



My problem is in login control, password text box is not taking any changes. I cannot put value for password textbox in login control. My purpose is, in my login control if some one checked in "Remember me next time" then next time the user id and password will be autometically set from cookie. So user just need to click on LogIn button. My code is like bellow...

HttpCookie cookie = Request.Cookies["SiteSettings"];

Login1.UserName = cookie["Username"];

Login1.Password = cookie["Password"];


Can anyone help me please.


Snap It! - How to take screen shot using .Net

We all would have used snap shots (screen shots) to illustrate bugs or behavior or something that others could understand by seeing them. For taking snap shots we just hit the "Print Screen" key and copy it to Ms Paint and save it. Ever wondered how to programmatically take a snap shot? Then this article is for you.

PDA Keyboard v1.0 Light Edition - Full Screen Keyboard

The default keypad on Windows Mobile is not at all finger friendly, there is no way you can use it with your fingers. I have trouble using the stylus with it too. But there are many freeware option available to make the SIP ( Software Input Panel - check the Glossary ) finger friendly. Some of these are HTC Diamond keyboard, Blimkeys, PocketCM Keyboard and then now we have PDA Keyboard v1.0 Light Edition from pdamedia.biz. When you hit the blue button it goes into fullscreen mode , then you can use both your hands for typing.

I thought this would be simple... Trying to create a login does an ajax check before submit


I have the standard .net login control that is working.  (Still learning .net after 15yrs of classic)

What I want to do is OnButtonClick run a javascript function (to do an ajax call to the db to check if login is valid or not) and if it returns true, then submit the form normally, else don't submit. The piece that I can't figure out, is how to correctly override the default click even to hit my JS routine and then submit the form properly afterwards.

Thanks ahead of time

Setting Screen Resolution



  I am developing a website in asp.net.How can i make my web pages view same in different screen resolutions.I am using 1024*768 resolution

How to modify the login control



I'd like to record more information than the default control allows as well as perform actions with the input when the form is submitted but I'm having trouble figuring out how.

So firstly, if I want to record the middlename for example, how would I do that, and by default, where would it go if anywhere?
When the form is submitted, I'd like to take specific input, such as just the middlename for example, and write some linq to sql code to specify when and how it's stored.
In what event would I put this code?


create user wizard login error message dont show in a message box?




i am using create user wizard and capturing other information within content template when a new user

registers. Some of the textboxes are binded to required field validators.


there is a validation control on the page and ShowMessage box is True.

If they dont complete some of the text boxes then the message box pops Up with the error message.

It does not however include information errors like "User already exists" or Email address already exists

from the create user wizard membership  UserName and Password Textboxes


is it possilbe to hook all of these up so I get one message box with all errors including membership ones?




Using network login



Is anyone have sample code to set up log in page using network login?

For example: User Name(same as Network Login)

                     Password(Same as Network Login)

Your help is highly appreciated.



Hi All

VS2005, .Net 2.5

i have been building a website and testing it in google chrome, which has been working fine.

i am now testing it in IE and firefox and the asp:login doesnt work, it doesnt even post back when i click the 'login' button.

anyone and idea what might be going on? im not sure where to start, as i mentioned above the login works fine using google chrome.


Visual Web Developer 2010 Express "Copy Web Site" using different login


I created a site and am trying to grant another pesron access to upload changes to it without giving them my super-user login.

I made a login for her but I can't test whether it works or not because no matter how much I "disconnect" in the Copy Web Site page of VWD 2010, reconnecting to the same site always logs in as my superuser account without prompting me for a login again.

How do I test is the account it set up correctly before having her try to upload to it?    I want to force the login to remote site dialog to pop up again to test her account.

Any ideas?

Upload a Print Screen?


Is it possible to Print Screen and then immediately Paste into a .NET app and upload to a server?  I'd like to skip the step of the user having to first paste the screen into an image program and save as a jpg, gif, etc.  Thanks!

Detect Browser Screen Size??


Hi Everyone,  I need to detect the size of the user's screen for mobile devices (especially the BlackBerry). I've read a lot of pages that seem to refer me to the Request.Browser object, but I'm finding that this object doesn't have the correct values. For example, I have a BlackBerry and when I use the Request.Browser to get the screen size, it tells me it is 640x480. Well, I know it's not that big since an image of 300px wide just barely fits. Also, when I run on my desktop browser, it also says my screen is 640x480. I can assure you, it is not 640x480! ha!

  How does anyone reliably get the browser's screen size?? Do I have to revert to some kind of JavaScript? If so, where can I read more about it? Will it be any more reliable? Someone must have an idea about this. Thanks in advance!!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend