c# - HtmlElement setAttribute access denied -


i have class called input.cs, i'm passing existing form instance in constructor.

then there code:

private async task populateinput(htmlelement file, string value) {     file.focus();     var populatetask = task.delay(500).continuewith((_) =>     {         file.setattribute("value", value); // <- access denied error     }, taskscheduler.fromcurrentsynchronizationcontext());      await populatetask;      await task.delay(500); }  public async task populate(string fieldselector, string fieldidentificator, string value, string fieldtype = "input") {     var elements = mainform.webbrowser.document.getelementsbytagname(fieldtype);     foreach (htmlelement file in elements)     {         if (file.getattribute(fieldselector) == fieldidentificator) // example file(input?) name == title         {             file.focus();             if (fieldtype == "input")             {                 await populateinput(file, value);             }             else if (fieldtype == "upload")             {                 await populateuploadfile(file, value);             }         }     } } 

this line: file.setattribute("value", value); produces access denied error , don't have idea what's wrong code.

exact error:

a first chance exception of type 'system.unauthorizedaccessexception' occurred in system.windows.forms.dll  (exception hresult: 0x80070005 (e_accessdenied)) 

calling method:

input.populate(fieldtype, fieldidentificator, value).continuewith((_) =>             {                 messagebox.show("field populated!");             }, taskscheduler.fromcurrentsynchronizationcontext()); 


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -