Windows Credentials dialog won't show when navigating using axWebBrowser - c#

I'm doing some maintenance work on a legacy app that is using AxSHDocVw.AxWebBrowser to access in an intranet website. The web site required Windows Authentication. When I navigate to the page directly using IE I get a pop-up asking for Active Directory credentials, but when I try to WebBrowser.navigate() to it I immediately get:
Refreshing the page using the provided link gives me an UNAUTHORIZED response.
Is there something I need to do when setting up the AxWebBrowser control so that it properly displays the credential popup?

Okay, found the answer, and as usual it's a coding issue. The original author of this code set it so that no pop-ups could happen (axwebbrowser.silent = true). He did it to prevent Javascript errors popping up (as opposed to, you know, FIXING the javascript errors), but a side effect was that the dialog box for credential entry wouldn't show up. Removal of that line fixed the issue.

Related

How to effectively change authentication method in ASP. NET web.config?

I am trying to launch ASP.NET project on a local computer. IIS responds with 401.0 status code, stating that "authenticated user does not have access to a resource needed to process the request". Authentication mode is set to Windows in my web config, nonetheless logon method in Detailed Error Information is "Anonymous". Changing it to "None" brought no change. So how do I change authentication method that way so I log in via Windows Authentication?
I found out what happened and it’s hilarious. Turns out that Windows Auth was disabled in project properties, and anonymous auth was enabled instead. All the info I found before gave advice of opening project properties and switching auth method to Windows Auth. I tried to do this but somehow properties window didn't open, and they said that it was to open right on click on the project in solution explorer.
And it actually did open, although my laptop's screen covered the area of monitor where it opened. So when I closed my laptop I immidiately saw needed properties panel, switched auth method, fired up IIS and everything got into order.
So here's my wisdom: always make sure that you see the whole picture :)

Atlassian account logon through WebBrowser control in WinForms application

I m wondering how to log on Atlassian account in WebBrowser control.
Create new WinForms application in Visual Studio.
Place WebBrowser control on main form.
Set URL property of control as "https://id.atlassian.com/login"
Run application. You will see this screen.
Then enter valid credentials for Atlassian account.
See this error message below.
How to overcome this problem? Thank you.
P.S. I m, of course, aware that standard WebBrowser component uses very outdated IE by default. I properly updated registry to ensure that IE11 is loaded into control.
I found this issue JRACLOUD-71973 in official bug tracking of Atlassian indicating that it is general problem not only with Confluence but with JIRA also. I suppose that Atlassian cloud products do not work with IE 11 anymore in principle, be it full IE application or just WebBrowser control. It is astonishing that Atlassian actually dropped support of quite popular web browser. Perhaps, we must monitor this issue to know when / if this issue will be resolved.

Selenium Authentication Popup preventing driver close or quit

I have a selenium automated task setup to login to a website to retrieve some information. It's very basic in the automation. Just logging in and clicking two links. I am running into an issue that is proving to be a problem.
The site in question uses the Authentication Required popup which is not a javascript popup but rather the regular windows auth popup. From what I have read this isn't handled out of the box with selenium.
I am using the "http://Username:Password#url.com" to get to the site but every now and then the site itself has issues on their end where it will prompt me again from username/password randomly. Sometimes I have to enter the username/password twice in a row when navigating there by hand.
Since my task just loops continuously for a few hours picking up the needed info I figured I would just use WebDriverWait to verify an element is present on the page. If the authentication popup appears, the element isn't present. No need to care about this run, so just start over.
The problem I am having is that when the Authentication popup is displayed and I hit my timeout limit I want to close the driver/browser window so that I can start the task over again. However, driver.Close() and driver.Quit() are not doing anything. The browser remains open and the unloaded page is still there with the login popup.
Is there anyway I can force close this? Switch focus to the browser window then force close?
The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box. The below code was tested on Google Chrome in java.
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(new UserAndPassword(Username, Password));
In case it doesn't work and you might want to try this:
https://stackoverflow.com/a/40757504/7071055

Unable to add multiple redirect URLs with Microsoft Live OAuth service

I have an ASP.Net C# Web Application in which I have added Windows Live oAuth authentication (I am not using the code supplied by the Visual Studio project template for oAuth). I have two return pages in my application where the user should come back after authenticating with the Windows Live oAuth Service. The reason I have two end points is to distinguish two different modes in my application based on where the user returns.
Anyways, the problem is that when I add the second URL in the configuration screen of Microsoft Windows live at https://account.live.com/developers/applications/apisettings/, the Microsoft Live page simply does not save it. Here is what I am doing:
Go to https://account.live.com/developers/applications/index
Click Application name and then edit Settings
go To API Settings
Click "Add another redirect URL"
Added my second URL and clicked save.
The second text box where I entered the URL simply disappears and my second URL does not work in the oAuth flow.
If any of you has faced a similar issue, do you have a work around? If this is something Microsoft should fix, where should I raise this bug with Microsoft?
Update: I have also tried a work around of creating two applications, so that each one has one of the return URLs, but Microsoft does not allow two applications with the same root domain URL. :(
I have the same issue.
This is not your fault, and there is nothing other than Microsoft would be able to fix it.

Is it possible to 'sandbox' IE in a windows form?

Say I have a webbrowsercontrol inside a windows form, and the user logs in to a secure site from the form. If the user were to open IE separately, it would also show them logged in. Is it possible to isolate the windows form's IE instance?
The WebBrowser control is built on top of the WebBrowser ActiveX, which lies on top of the WinInet. So you should be able to affect its behavior through the WinInet API.
You can try calling InternetSetOption WinInet API to set the INTERNET_OPTION_END_BROWSER_SESSION option to end the current session and start new one. To ensure that the call will affect only the current process, use the INTERNET_HANDLE_TYPE_INTERNET handle.
you don't mention your version; the behavior changed from IE7 to IE8.
In IE7 and IE6, you can open multiple windows and authenticate with different userids on one site.
In IE8, your session state is shared across browser sessions.
You can open IE with privacy mode on; this should allow the session to be sandboxed.
IE8 has the command line switch -nomerge, which starts the browser with a new session
When you log into a site, you generally get a cookie passed to your from the server that marks you as "logged in" (VERY oversimplified....). My guess would be to delete the cookies. See here:
How to delete Cookies from windows.form?

Categories