Get actual href value from a html in c# [duplicate] - c#

This question already has answers here:
html agility pack url scraping-- getting full html link
(2 answers)
C# Convert Relative to Absolute Links in HTML String
(10 answers)
Closed 2 years ago.
I want to get the actual href value, which actually differs from what is being shown in inspect element in a browser.
For more clarity, if I go to this (http://185.105.101.95/S/Money.Heist/S01/720p.x264.WEB-DL/) page and inspect html content then for the first href tag the value is "/S/Money.Heist/S01/" but when I click on the link, it directs to "http://185.105.101.95/S/Money.Heist/S01/". So my question is how I can get the actual href value using html elements and c#. Or by using jquery.
Thanks for helping

Related

how to display another html in current html using asp.net? [duplicate]

This question already has answers here:
How to display content of a .html file in a web page?
(4 answers)
How to make a html page to show content from another url
(5 answers)
Closed 1 year ago.
Okay, so the idea is, someone uploads a word doc that has been turned into html file using words own saving system. Now I need to display said word doc in html form, modifie it and turn it back into docx form.
How can I (once i know the file specific location in a x directory) open it up in the current html without having to redirect to a new page?

How to enable the use of HTML tags in C# [duplicate]

This question already has answers here:
What does HTML.Raw do?
(4 answers)
Closed 4 years ago.
when I list out information from my database through C#, if the info contains html tags such a; pagagraph (p) or title (h1) it does not use them but simply list them out as is, I searched the internet and have not found a solution to my problem yet. What I've discovered is that people have had problems with saving their info onto the server that uses html tags but my problem lies in the fact that when the info is listed out the tags just stay text.
If you have HTML tags in a database that you want to appear on in a browser as text, you can convert them with HtmlEncode() so that <div> will be displayed on the screen instead of interpreted as the beginning of and HTML div.
If your prblem is the other way, where it's stored in your database as <div> and you want an actual div, you can use HtmlDecode.()

Selenium Web Page in Text Search [duplicate]

This question already has answers here:
Finding text on page with Selenium 2
(4 answers)
Closed 8 years ago.
How can I make a text call using selenium on a web page?
Should I use searchContext?
I tried using xpath but I get an error.
//***********************
okay all thanks. my code is working :)
var link = _driver.FindElement(By.XPath("//*/a[contains(.,'btctrader')]")).Text;
Well, this will check if text exists on the page:
driver.getPageSource().contains("Text");
But this is just one of many ways. You'd need to be more specific if this is not what you're looking for.

looking for a way to retrieve the information from an <a href> tags. E.g. <a href="www.facebook.com"> [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to use HTML Agility pack
I am looking for a way to retrieve the information from an tags. E.g. is there anyway to retrieve www.facebook.com? I am using c# and i tried using htmlagilitypack but i can't seems to find a method to retrieve it.
Would appreciate it very much =)
I would ultimately use javascript in this case. Then you can target the dom object and reference the attribute "href". However in code behind, you will probably need to use a regular expression to mind out the href.

How to display string and prevent encoding HTML tags [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Emitting unencoded strings in a Razor view
I have a string that has HTML tags such as:
string = "hi<br/>bye";
I want to be able to output this in my C# ASP.NET MVC3 (Razor) view such that the <br/> tags are preserved and not encoded. I know encoding is happening automatically to prevent cross-site scripting.
What's the best way to handle this?
I think you're looking for #Html.Raw.

Categories