wmi - Using ManagementScope in ASP.NET -


i'm trying connect , modify dns server using asp.net mvc application. when executing following code, error:

    private void logon()     {         _namespace = "\\\\" + _servername + "\\root\\microsoftdns";          var con = new connectionoptions                       {                           username = _username,                           password = _password,                           impersonation = impersonationlevel.impersonate                       };         _managementscope = new managementscope(_namespace)                                {                                    options = con                                };         _managementscope.connect();     } 

and error is:

access denied. (exception hresult: 0x80070005 (e_accessdenied)) description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.unauthorizedaccessexception: access denied. (exception hresult: 0x80070005 (e_accessdenied)) asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via , identity anonymous user (typically iusr_machinename) or authenticated request user. grant asp.net access file, right-click file in file explorer, choose "properties" , select security tab. click "add" add appropriate user or group. highlight asp.net account, , check boxes desired access.

how should solve error?

you need @ identity site running under , make sure identity has permissions make changes


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -