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 70k
  • Answers 70k
  • 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're right yes. The architecture of a system is its… May 11, 2026 at 1:07 pm
  • added an answer create procedure zz (@cmdin varchar(255)) AS --missed this EXEC master..xp_cmdshell… May 11, 2026 at 1:07 pm
  • added an answer You will want to add the 'Content-Disposition' header to the… May 11, 2026 at 1:07 pm

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've got a lot of mysql data that I need to generate reports from.
What's the best way to do the semantic equivalent of the traditional sleep() system
I'm trying to find a source control for my own personal use that's as
I haven't a clue about encryption at all. But I need it. How? Say

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.