Why this exception in the following code takes off

foreach (HtmlElement ell in inputEl) { if (ell.GetAttribute("value") == " sell ")//в этой строке кода вылетает исключение { // } } Дополнительные сведения: Отказано в доступе. (Исключение из HRESULT: 0x80070005 (E_ACCESSDENIED)) 

I read about this exception, it seems like it crashes when there are not enough access rights. But I just work with a regular site, its html markup. And I also noticed one thing that one pass fulfills, on the 2nd an exception crashes, you close the application, start it again, once again work on the 2nd pass on the cycle this exception.

    1 answer 1

    I figured it out myself, the exception crashes when you try to get \ set the attribute value of an element that has no attributes.