Arkadaşlar bir projem için ie,frefox ve chrome de o an açık olan url yi öğrenmem gerekiyor.Bu konu hakkında bilgisi olan var ve yardımcı olursa sevinirim.
Şimdiden herkese teşekkürlerimi sunarım.
Saygılarımla.
C# ile Aktif Url Öğrenmek
6
●1.124
- 21-11-2013, 15:01:12CoLLeR adlı üyeden alıntı: mesajı görüntüle
string url = HttpContext.Current.Request.Url.AbsoluteUri; // http://localhost:1302/TESTERS/Default6.aspx string path = HttpContext.Current.Request.Url.AbsolutePath; // /TESTERS/Default6.aspx string host = HttpContext.Current.Request.Url.Host; // localhost
bunu deneyebilir misin... - 21-11-2013, 15:08:03İlginiz için teşekkür ederim maalesef olmadı bu web(ASP.NET) için geçerli sanırım.devveloper adlı üyeden alıntı: mesajı görüntüle
- 21-11-2013, 15:13:46
// there are always multiple chrome processes, so we have to loop through all of them to find the // process with a Window Handle and an automation element of name "Address and search bar" Process[] procsChrome = Process.GetProcessesByName("chrome"); foreach (Process chrome in procsChrome) { // the chrome process must have a window if (chrome.MainWindowHandle == IntPtr.Zero) { continue; } // find the automation element AutomationElement elm = AutomationElement.FromHandle(chrome.MainWindowHandle); AutomationElement elmUrlBar = elm.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Address and search bar")); // if it can be found, get the value from the URL bar if (elmUrlBar != null) { AutomationPattern[] patterns = elmUrlBar.GetSupportedPatterns(); if (patterns.Length > 0) { ValuePattern val = (ValuePattern)elmUrlBar.GetCurrentPattern(patterns[0]); Console.WriteLine("Chrome URL found: " + val.Current.Value); } } }şöyle bir kod var. sanırım çalışır 350 ms gecikiyormuş çalışırken ama çok büyük sorun teşkil etmez. O an açık olan chrome sekmesinin adresini buluyormuş. Diğer sekmeye geçersen diğer sekmenin url sini gösterir. Diğer browserları araştıramadım daha. - 21-11-2013, 16:31:32İlgin için çok teşekkür ederim ama buda çalışmadıVoyL adlı üyeden alıntı: mesajı görüntüle

Ben şöyle bir kod buldum fakat kullanamadım.Intptr değeri istiyor onu anlamadım.
FindWindowEx(intPtr,
IntPtr hAddressBox = FindWindowEx(intPtr, IntPtr.Zero, "Chrome_OmniboxView", IntPtr.Zero); StringBuilder sb = new StringBuilder(256); SendMessage(hAddressBox, 0x000D, (IntPtr)256, sb); temp = sb.ToString(); - 22-11-2013, 18:04:42öncelikle google chromun intPtr'sini aldırtıp gerekli yere yazdırman gerekiyo bu değişken bi tanımdır handle alıp Ptr değerine girersen olabilir belki tam bilmiyorum bu döngüyü sağlaman lazım kod çalışır heralde yada google apilerine bak mutlafa apiler gereklidir bu konu içinCoLLeR adlı üyeden alıntı: mesajı görüntüle
