Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 145349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:24:29+00:00 2026-05-11T08:24:29+00:00

I am a systems guy and currently doing a part time web development project

  • 0

I am a systems guy and currently doing a part time web development project so am pretty new to it. I am trying to write a http client for http://www.portapower.com.

It will for certain items which are posted on the website and if they match a particular requirement it will print a message.

While trying to access this page:

http://www.portapower.com/getbainfo.php?fclasscode=1&code=CB1831B.40H&fbrand=QUNFUg==

The website redirects me to a default register page:

http://www.portapower.com/defaregit.php

Here is a snippet of what I coded:

CookieContainer myContainer = new CookieContainer();  HttpWebRequest request = (HttpWebRequest) WebRequest.Create('http://www.portapower.com/' + urlpart); request.Credentials = new NetworkCredential('****', '******'); request.CookieContainer = myContainer; request.PreAuthenticate = true; request.Method = 'POST'; HttpWebResponse response = (HttpWebResponse) request.GetResponse();  Console.WriteLine(response.StatusCode); Stream resStream = response.GetResponseStream(); Console.WriteLine(resStream.ToString()); 

I do have the username and password and it works fine when used from a browser. Please tell me if this a correct way to access a authenticated page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:24:29+00:00Added an answer on May 11, 2026 at 8:24 am

    It depends on how the website is authenticating users. If they are using basic authentication or Windows authentication, then you can set the Credentials property of the HttpWebRequest class to the username/password/domain information and it should work.

    However, it sounds like you have to enter the username/password on the site, which means you are going to have to login to the site first. Looking at the main page, this is what I find in the <form> element that handles login:

    <form name='formlogin' method='post' action='./defalogin.php' >   <input name='emtext' type='text' id='emtext' size='12'>   <input name='pstext' type='password' id='pstext' size='12'>   <input type='submit' name='Submit' value='Logn in'      onClick='return logincheck()' > </form> 

    I’ve included only the relevant portions.

    Given this, you have to go to the ./defalogin.php page first with the HttpWebRequest and POST the emtext and pstext values. Also, make sure you set the CookieContainer property to an instance of CookieContainer. When that call to POST returns, it’s more than likely going to be populated with a cookie which you will have to send back to the site. Just keep setting the CookieContainer property on any subsequent HttpWebRequest instances to that CookieContainer to make sure the cookies are passed around.

    Then you would go to the page indicated in the link.

    Of concern is also the logincheck javascript function, but looking at the script sources, it does nothing of note.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 64k
  • Answers 64k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You'll want to use FirstOrDefault to extract the first matching… May 11, 2026 at 10:43 am
  • added an answer Class vs. struct Using class or struct keyword is a… May 11, 2026 at 10:43 am
  • added an answer I have managed to fix this. by setting the command… May 11, 2026 at 10:43 am

Related Questions

I am working with legacy systems at the moment, and a lot of work
I am using a System.Random object which is instantiated with a fixed seed all
I am designing a system which will at some point require to send email
i am creating a system. What i want to know is if a msg
I am developing a system as an aid to musicians performing transcription. The aim
I am building a system for distributing packages (.zip archives) created by different organizations.
I am writing a dhtml application that creates an interactive simulation of a system.
I have a System.Windows.Forms.TreeView docked inside a panel. I am setting a node selected
I am designing a new System and I have a lot of Interfaces that
I am investigating a production system where there are several Windows services communicating with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.