Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capture a url before navigating in a webbrowser control

Status
Not open for further replies.

estafford

Programmer
Sep 5, 2002
22
0
0
US
Greetings,
I am creating an application for browsing our intranet using VS C# and a webbrowser control.
What I want to do is:
Capture the url string before navigation and compare it to a handful of domains I have in an array. If it matches, allow the navigation. If it dosen't match, cancel the navigation. This will prevent navigating outside the intranet.

How do I capture the url string before the navigation takes place?
 
I finally figured this out for myself.

object_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e){
string strWebpage = e.uRL.ToString();
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top