Accessing a secure (https) server via MFC WinInet classes.

I am attempting the access a secure (https) server via the MFC WinInet
classes and I am having difficulty. I have scoured the newsgroups and
the Internet for suggestions, but I have not been able to find anything
useful.

As the MSDN Knowledgebase suggests, I use CInternetSession,
CHttpConnection and CHttpFile to connect to a server and send it a
Request. My Visual C++ 6.0 app works fine when I use
GetHttpConnection() to get a connection to a non-secure server.
However, when I name a secure server (https://...) as the URL, a
subsequent call to CHttpFile::SendRequest() always results in an
internal exception (12005--The URL is invalid).

Can the WinInet classes be used to access a secure server? If so, could
you please provide me with sample source code that shows the correct
way of doing this?

Thanks.

0
jhewson (3)
11/8/2006 6:29:49 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
2260 Views

Similar Articles

[PageSpeed] 32

Wow, thanks for all the helpful suggestions--this newsgroup is soooo
helpful.

Anyway, I have found answers to my own questions, so thought I should
post them for the next person to see.

As is turns out, I found that I could not use "https://" in the server
URL field in the call to GetHttpConnection. For example, if the server
URL is "https://servername.com", I must use "servername.com". Moreover,
the port number must be set to INTERNET_DEFAULT_HTTPS_PORT (see below).

CInternetSession Session;
CHttpConnection* pConnection =
Session.GetHttpConnection(_T("servername.com"),
INTERNET_DEFAULT_HTTPS_PORT, "", "");

Next, if the URL includes further path info, that must be added to the
call to OpenRequest. For example, if the full URL is
"https://servername.com/pathname", then "/pathname" must be passed to
OpenRequest. Moreover, several flags must be passed to OpenRequest (see
below).

CHttpFile* pFile =
pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "/pathname",
NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID);

These modifications allowed me to access the secure server that I was
after.

James.

1
jhewson (3)
11/10/2006 3:49:57 PM
James wrote
>
> CHttpFile* pFile =
> pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "/pathname",
> NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE |
> INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
> INTERNET_FLAG_IGNORE_CERT_DATE_INVALID);

Hi James,

you should get a valid Certificate for this server instead of blindly
trusting *any* certificate!

Anyways, thx for the answer :)

Greetz

0
11/10/2006 6:21:26 PM
Reply:

Similar Artilces:

Security Audit failure
I have been tracking down a security audit logon failure, and I found it - here is what is going on. In Windows Server 2008 R2, If I open Devices and Printers, right click on any of the Printers, click Printer Properties, then click the Sharing tab, I get 2 logon audit failures - one by explorer.exe trying to logon as Guest, and one by printui.exe trying to logon as Guest. Guest account is disabled which is why the audit failure occurs. Also, if I bring up Windows Explorer and click around in folders, I will get a logon security audit failure as well on the Guest account. ...

Outlook Web Access AutoSignature
I would like to know if it's possible to have autosignature in Outlook Web Access, and if so how to implement it. If anyone can help, it would be greatly apreciated. Thank You. It depends on the version of Exchange - Outlook Web Access is a function of Exchange, not Outlook. Exchange 2003 does this natively, previous versions may have a third party add-in that will allow users to do this. For better information, post in an exchange group such as microsoft.public.exchange.admin. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due t...

Restricting access to note attachments
Hi all, is there a way to restrict access to attachments on notes to specified users. I know we can, using the Security Roles, define who can and can't read/ write the notes fields but we would like our users to be able to view the note, but not open the attachment(s) unless they are the owner of that note (or at least in the business unit, etc.). I know this could be done for Word/ Excel files in Office (Password protection) but are looking for something more encompassing for all attachments inside CRM. Thanks, -- Matt Pring On Oct 21, 3:54=A0pm, Matt Pring <MattPr...@discus...

ADO/SQL Server: datetime column appears to be "1901-1-1 00:00:00" after insertion
Hi. I'm using ADO connection and recordset to insert records from Table1 to table2. The database is SQL Server 2005 and the connection is established before the following the code snippet with "csvSQL". The code works without any error but the result is not what i want. The issue is that when aTIME1 is "" and is inserted to table2, TIME1 of Table2 becomes "1901-1-1 00:00:00". FYI, TIME1 is of type datetime and allow null. What i expect is when aTIME1 is "" and inserted to Table2, TIME1 should be null. Please help. Thanks. Set csvR...

TWO CRM SERVERS 02-03-06
Is it possible to install two CRM Servers in the same domain using a single Exchange Server? It will work four outbound email, but even with the v3.0 router changes, I do not know if it will work for inbound email. Probably need to check with support on this for sure. -- Matt Parks MVP - Microsoft CRM "Irshard" <Irshard@discussions.microsoft.com> wrote in message news:C18EF5EA-F47C-44CC-9B18-D2799DAF3ED4@microsoft.com... Is it possible to install two CRM Servers in the same domain using a single Exchange Server? yes it is. NOTE: This is already assuming you have two...

RPC over HTTPS only + Encrypt data between Outlook and Exchange server Option
I need to clarify the difference between having only RPC over HTTPS setup and working fine.... and adding the option in outlook 2003 to Encrypt data between Outlook and Exchange server Option what i need to know is: 1) what is gained in adding this option? 2) without adding this option what is the security issue? ...

using paid servers with Outlook Express.
I've been using news.eternal-september.org, a free text server with Outlook Express. Does giganews work with Outlook Express? Can Outlook Express deal with binary newsgroups? Should I use a different news program like Forte Agent? I have a very old version of Forte Agent, but I like having my newsgroups right there by my email. Oops. I should have posted to microsoft.public.outlookexpress ...

Access 2003 and Access 2007 Synchronization
I'm setting up a new business relationship with a company in Portugal. They use Access 2003. I have just bought MS Office Professional 2007 (with Access 2007). Our plan is that they will send, once a month or so, their Access db then we will update and add to that db and then return it after another month or so. There probably won't be a lot of updates on our end so the monthly cycle should work. After they synchronize, they will send a new version of the db and we will start over. My goal is to keep everything as simple as possible partially because I don't know how skillf...

Excel Row to Access Columns
Hi, I have a single row in Excel with a lot of data, what I need to do is move that to a column in Access. I need some way to automate that. I know the easiest way to do that would to just transpose it in excel and then import in access.But I cant do that as I just get that excel file with one row and I need some way to automate the process in Access. thanks m -- mk389 ------------------------------------------------------------------------ mk389's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15272 View this thread: http://www.excelforum.com/showthread.php?...

Help displaying a random record in a form--Access newbie
Hello, I am new to Access, so if anyone can help me, please assume I know absolutely nothing! I currently have a table with two columns, ID and CHORE. In each row, the ID number corresponds to a chore that I have entered. I would like to create a form with a button and a text field such that when I press the button, a random chore is displayed in the text field (supposed to make chores more "fun" for my son). There is no need to remove this record from future clicks (the same record can come up over and over without any problem for me) Can anyone explain to me (in pai...

Access
Hi My form takes a few moments to load up as it is fairly substantial SQL statement is there a way to get something to display a graphic or 'loading...' message to appear why it calculate the contents? Steve ...

Moving contacts to Exchange 2000 Enterprise Server
Does anyone know an easy way to move my smtp addresses from CCmail 8.2 address book (about 400 of them) over to contacts in Active directory. I am running Windows 2000 Server and Exchange 2000 Enterprise Server. Cheers Crazy cc:Mail's export command with the /DIRECTORY switch can export them in an quasi - ldif format which could be massaged and used with ldifde to import. cc:Mail's Import/Export users guide will help on the export start with 237677 Using LDIFDE to import and export directory objects to Active Directory http://support.microsoft.com/default.aspx?scid=kb;EN-US;...

access mail on WEB
Is there a way i can check emails from exchanger server 5.5 from an internet browser. I have Exchange 5.5 in win NT 4.0. Thanks! Yes - install OWA (Outlook Web Access) and open up the needed ports in your firewall (80 for http; better to use SSL and port 443 instead). disk0nek wrote: > Is there a way i can check emails from exchanger server > 5.5 from an internet browser. > > I have Exchange 5.5 in win NT 4.0. > > Thanks! ...

access or mount mirrored hard disks
Hi, is it possible to access a mirrored harddrive? or mount the mirrored volume by using api or mfc commands? Thank you in advance Wimpi ...

Access Database In Great Plains
I was wondering if anyone knew how to have the databases that are stored in access transfered over to great plains. I'm current running version 8.0 any help would be greatful. thanks Search Customer Source for integration Manager. MS Access databases can be used as a data source. Vincev "jake" wrote: > I was wondering if anyone knew how to have the databases that are > stored in access transfered over to great plains. I'm current running > version 8.0 any help would be greatful. thanks > > Hi Jake, Is this something you need to do regularly or is it ...

CRM v4 Accessibility Improvements
Hi all: Does anyone know if any improvements have been med to CRM v4 in the area of accessibility for handicapped users? One of my customers has a user who is blind and they need to make the software accessible to him. Thanks in advance for any and all help. John. Hi John, We have added following Accessibility features in CRM 4.0 : 1) High Contrast Mode (Tools --> Options --> General Tab --> Enable high contrast settings) 2) All the Form input elements have <LABEL FOR> to aid in screen readers. 3) All the Images have a ALT tag (for non text elements) etc. Thanks! Ma...

SMTP server #2
I have a basic question on SMTP emails. If I point to a SMTP server that is different than my designated email host address, who actually sends out the emails, my designated email server or the one I pointed to? To help clarify we have our email and web hosted by a 3rd party Company "A", and my ISP is with Company "B", I have been having problems with duplicate emails being sent to several clients. So I pointed my outbout emails to a different SMTP server (Company B's smtp server) in an attempt to see if the problem goes away. So I am check to see if my...

Upsizing Access to SQL Server 2000
Hello, I am new to SQL Server. I am trying to use the Database upsizing wizard to upsize a Access 2000 database into SQL Server 2000. They are both on the same machine (running Win 03 Server). I cannot connect to the SQL Server. Error as below: Connection failed: SQLState: '01000' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory] ConnectionOpen(Invalid Instance()). SQLState: '08001' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory]Invalid connection. ...

Remote Server Question
Right customer wants to acces his win2k8 server remotely. IT is using a generic printer from the server. At the office the printer is on a network. Terminal Services are being used to access the server remotely. What needs to be done to get said printer working? -- Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca God, Queen and country! Never Satan President Republic! Beware AntiChrist rising! http://twitter.com/rootnl2k http://www.facebook.com/dyadallee UK Time for a Common Sense change vote Liberal Democrat / Alliance Whether "at the o...

Public Folders on 2nd server through OWA #2
HI I'm reposting it with new information. A client is running two exchange 2000 SP3 servers. One for mailboxes/outlook web access and 2nd sever dedicated for public folders. None of the servers is designated as front end server. Users can access mail through OWA using http://exchange.domain.com fine but when they tries to access public folders on the second server the browser points to http://server2.domain.com/public/foldername which is not accessible from outside. 2nd exchange server hosting pubic folders does have IIS installed and within LAN i can acess public folders on second se...

Outlook Web Access #19
We have have OWA at my work and I would like to configure Outlook 2003 to synchronize with my desktop at work, is this possible Thanks B ...

Have a user account accessible to multiple users
I have an issue where there is a user account that has multiple alias emails.(reservations@domain.com, info@domain.com, CustomerService@domain.com) I have an exchange 2003 server. My issue is that i need to have muliple users access these emails so they are never missed. What is the best way to accomplish this? I was thinking a public folder. But i want to know the best way to do this? On Sat, 12 Jun 2010 21:37:04 -0500, "Dan V" <dvalenti54athotmail.com> wrote: >I have an issue where there is a user account that has multiple alias >emails.(reservati...

outgoing email server
Our CRM was setup to use a SMTP virtual server in IIS on our CRM server. We also have an incoming mail server (exchange) in the same domain. Mail delivered through the CRM SMTP is not always delivered and returned to the user as undeliverable. If we send to the same email address using outlook (exchange server) to send out then the mail is delivered. Do I need to change the CRM server so it relays through the exchange server? I found a KB article referencing reg keys for changing the SMTP server but these keys don't exist in the registry. What is best way to setup? If keys do no...

Going offline without write access to registry
I suggest that POS doesn't go offline if it can't write into registry, displaying a message box instead telling that it couldn't access the registry. What happens if the POS machine goes offline without having access to edit the registry? This typically happen when the user is a normal user (not a power user) 1. The POS application will try to connect to the server main database within the pre-configured ‘Connect Timeout’ in the RMS Administrator (Typically 15 seconds) 2. The application will then try to connect to the pre-defined offline database (which is usually stored loc...

RPC over HTTP security
Hi all, I have a general question in regards to the security of RPC over HTTP. If a client is connected with Outlook via RPC over HTTP, are there any possibilities of viruses/worms being transferred from the client machine to the host machine? I am not really talking about viruses within Outlook or the Exchange store, but more with viruses that would infect Windows on the client, and if it is possible for that to travel to the Windows host machine (the Exchange server). And, are there any products out there that will basically intercept this traffic and clean it of viruses/worms or other vu...