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 7792473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:11:43+00:00 2026-06-01T22:11:43+00:00

In my C# code I want to use InternetQueryOption which is defined in MSDN

  • 0

In my C# code I want to use InternetQueryOption which is defined in MSDN such as:

BOOL InternetQueryOption(
  __in     HINTERNET hInternet,
  __in     DWORD dwOption,
  __out    LPVOID lpBuffer,
  __inout  LPDWORD lpdwBufferLength
);

In my C# code I wrote:

    [DllImport("wininet.dll", SetLastError = true)]
            static extern bool InternetQueryOption(
            IntPtr hInternet, 
            uint dwOption, 
            IntPtr lpBuffer, 
            ref int lpdwBufferLength);

My C++ code:

...
HINTERNET hRequest = HttpOpenRequest(hConnect, "POST","/BM-Login/auth-cup", NULL, NULL, accept, secureFlags, 0);
    DWORD dwFlags;
    DWORD dwBuffLen = sizeof(dwFlags);

    InternetQueryOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,
            (LPVOID)&dwFlags, &dwBuffLen);

    dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA;
      dwFlags |= SECURITY_FLAG_IGNORE_REVOCATION;
      dwFlags |= SECURITY_FLAG_IGNORE_CERT_DATE_INVALID;
      dwFlags |= SECURITY_FLAG_IGNORE_CERT_CN_INVALID | SECURITY_FLAG_IGNORE_WRONG_USAGE;

    InternetSetOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,
                            &dwFlags, sizeof (dwFlags) );
...

How to write the same in C#? Thanks. (Sorry for my very bad English)

  • 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. Editorial Team
    Editorial Team
    2026-06-01T22:11:45+00:00Added an answer on June 1, 2026 at 10:11 pm

    I’d recommend using manged code for this instead of doing this via interop. Have a look at the WebRequest Class. Also, have a look at my answer to the stackoverflow question C# https login and download file for a working example of how this class can be used.

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

Sidebar

Related Questions

I want to use the following code to login to a website which returns
In my code i want to use if condition. In which i want to
So I have this C .dll source code which I want to use in
I have the following code which I want to use to make sure that
I want to use WebKit as the layout/rendering engine, and I want to code
I have a code base I want to use for both an ASP.NET MVC
I have a java code where I want to use Guava libraries CharMatcher function.
I have an underlying ruby game-engine code and I want to use the web
I want to use code beside files for my views in my ASP.NET MVC
I want to use regions for code folding in Eclipse ; how can that

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.