Sign in to follow this  

Problem opening URL

This topic is 2397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!
I'm trying to open a URL from a Dialog in MFC with the following code.
[code]
CWebBrowser2 m_WebBrowserCtrl.Navigate(URL.c_str(), NULL, NULL, NULL, NULL);[/code]

But it navigates to the URL at the computers where IE is installed. Otherwise it's not working. I've to read the default browser from Regsitry and open the URL with that browser. How to do this in MFC?

Share this post


Link to post
Share on other sites
I think CWebBrowser2is using IHTML, which requires IE installed.
[s]If you don't want to depend on IE, try some other library, such like Webkit or Gecko.
[/s](Please ignore it)[s] :rolleyes:
[/s]

Share this post


Link to post
Share on other sites
[quote name='wqking' timestamp='1306476279' post='4816312']
I think CWebBrowser2is using IHTML, which requires IE installed.
If you don't want to depend on IE, try some other library, such like Webkit or Gecko.
[/quote]
Will the above libraries work with the default browser(not any specific like IE or Chrome) that's installed in a System?

Share this post


Link to post
Share on other sites
Damn, forgot the very heavy libraries I said.

To open URL in default browser, try Win API [url="http://msdn.microsoft.com/en-us/library/bb762154%28v=vs.85%29.aspx"]ShellExecuteEx[/url]
I will do all your need.

[url="http://support.microsoft.com/kb/224816"]Here is some example[/url]

Share this post


Link to post
Share on other sites
[quote name='wqking' timestamp='1306477365' post='4816315']
Damn, forgot the very heavy libraries I said.

To open URL in default browser, try Win API [url="http://msdn.microsoft.com/en-us/library/bb762154%28v=vs.85%29.aspx"]ShellExecuteEx[/url]
I will do all your need.

[url="http://support.microsoft.com/kb/224816"]Here is some example[/url]
[/quote]

I've already tried this. But I got the following error:

APPLICATION ERROR:

This error has occurred for one of the following reasons:


(i) You have kept the browser window idle for a long time. Your session has expired.
(ii) You have logged in from another browser window.
(iii) You are accessing the application URL from a saved or static page.

If I use,
[code]CWebBrowser2::Navigate()[/code]
the same URL opens fine but not opening without IE. What else to do?

Share this post


Link to post
Share on other sites
Read your post on MSDN, another guy had answered you,

"So, the browser did open, and did navigate to the URL you asked it to navigate to. The server then responded with this page. Figure out why. ShellExecute did its job corretly."

Share this post


Link to post
Share on other sites
[quote name='wqking' timestamp='1306478046' post='4816320']
Read your post on MSDN, another guy had answered you,

"So, the browser did open, and did navigate to the URL you asked it to navigate to. The server then responded with this page. Figure out why. ShellExecute did its job corretly."
[/quote]

How to find out what's causing this error?

Share this post


Link to post
Share on other sites
[quote name='ratha' timestamp='1306477757' post='4816317']
[quote name='wqking' timestamp='1306477365' post='4816315']
Damn, forgot the very heavy libraries I said.

To open URL in default browser, try Win API [url="http://msdn.microsoft.com/en-us/library/bb762154%28v=vs.85%29.aspx"]ShellExecuteEx[/url]
I will do all your need.

[url="http://support.microsoft.com/kb/224816"]Here is some example[/url]
[/quote]

I've already tried this. But I got the following error:

APPLICATION ERROR:

This error has occurred for one of the following reasons:


(i) You have kept the browser window idle for a long time. Your session has expired.
(ii) You have logged in from another browser window.
(iii) You are accessing the application URL from a saved or static page.

If I use,
[code]CWebBrowser2::Navigate()[/code]
the same URL opens fine but not opening without IE. What else to do?
[/quote]

That error looks an awful lot like something the website is telling you, not your system at any level. I have a sneaking suspicion that whatever website you're trying to direct to has issues with browsers that are not Internet Explorer. Can you access the site fine without code? Simply going to the URL in your browser of choice that is not IE?

Share this post


Link to post
Share on other sites
[quote name='Flimflam' timestamp='1306488097' post='4816355']
[quote name='ratha' timestamp='1306477757' post='4816317']
[quote name='wqking' timestamp='1306477365' post='4816315']
Damn, forgot the very heavy libraries I said.

To open URL in default browser, try Win API [url="http://msdn.microsoft.com/en-us/library/bb762154%28v=vs.85%29.aspx"]ShellExecuteEx[/url]
I will do all your need.

[url="http://support.microsoft.com/kb/224816"]Here is some example[/url]
[/quote]

I've already tried this. But I got the following error:

APPLICATION ERROR:

This error has occurred for one of the following reasons:


(i) You have kept the browser window idle for a long time. Your session has expired.
(ii) You have logged in from another browser window.
(iii) You are accessing the application URL from a saved or static page.

If I use,
[code]CWebBrowser2::Navigate()[/code]
the same URL opens fine but not opening without IE. What else to do?
[/quote]

That error looks an awful lot like something the website is telling you, not your system at any level. I have a sneaking suspicion that whatever website you're trying to direct to has issues with browsers that are not Internet Explorer. Can you access the site fine without code? Simply going to the URL in your browser of choice that is not IE?
[/quote]

No. I can't access even with IE directly. It runs based on a session. How to open a URL that is based on a session with ShellExecute or is there any other way to open a URL that is based on a Session?

Share this post


Link to post
Share on other sites
You are asking very specific questions about an application we have no knowledge about. Step back, start by telling us what are you trying to do. Does you application interact with a website, obtain a session and expect to pass that on to the browser? How are you generating this URL? Is the website your own or some external service you have no control over?

A session is generally tied to a particular application (disregarding some kind of session hijacking attack).

Share this post


Link to post
Share on other sites

This topic is 2397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this