472,965 Members | 2,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,965 software developers and data experts.

InternetGetConnectedState gets Access denied when running as Local

nHi!

We have a C# .NET application (exe) that is started by a service (like a
watchdog) and the application is thereby runing as Local System account.

On cetain computers (only a very few of thousands) it seems like the call
InternetGetConnectedState gets FALSE back (even when there is a connection)
and when i check GetLastError it says 5=Access denied, that
InternetGetConnectedState got Access denied and thereby returns false (I
assume).

Summery:
-So it seems like the app gets Access denied when it tries to call
InternetGetConnectedState when app runs as Local System account.
-If we remove the call to InternetGetConnectedState and just go on,
everything works fine. (But we need the check, of course.)
-If we run application as User (not Local system account / service) then
application works.

The problem seem to appeared the latest weeks, but we're not sure.

Any ideas?

Regards
/Marcus

Jun 27 '08 #1
4 2604
Are you using this syntax?

//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}

________________________
sa@dailycoding.com
http://www.dailycoding.com
DailyCoding.com - daily code for C#, .NET, ASP.NET, SQL
Jun 27 '08 #2
Hi!

Thanks for your answer!
Are you using this syntax?
Yes, we do.

It works fine if we run "as user" (start exe manually) but if the exe run as
"Local System" (started by the service / watchdog), it fails.

This only happens on a few computers (aprox ten). We have thousands of
computers where it works and only about ten where it fails.

Regards
/Marcus

"DailyCoder" wrote:
Are you using this syntax?

//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}

________________________
sa@dailycoding.com
http://www.dailycoding.com
DailyCoding.com - daily code for C#, .NET, ASP.NET, SQL
Jun 27 '08 #3
I know the documentation refers to the "system" being connected to the
internet, but it's my experience that some user-specific registry entries
are sometimes used, and the system account won't have them. Are there any
proxy servers involved? The system account will fail attempting to check a
proxy server but a user can be validated.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972
"EGON" <EG**@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.com...
Hi!

Thanks for your answer!
>Are you using this syntax?
Yes, we do.

It works fine if we run "as user" (start exe manually) but if the exe run
as
"Local System" (started by the service / watchdog), it fails.

This only happens on a few computers (aprox ten). We have thousands of
computers where it works and only about ten where it fails.

Regards
/Marcus

"DailyCoder" wrote:
>Are you using this syntax?

//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}

________________________
sa@dailycoding.com
http://www.dailycoding.com
DailyCoding.com - daily code for C#, .NET, ASP.NET, SQL

Jun 27 '08 #4
Hi!

Yes you are right! As we run as Local System we will not get the user-proxy
but a default-proxy. This is solved by group-policies , to set per-client
instead of per-user... which has been done, then there is only one proxy
configuration for the whole client and not one per user. Anyhow, this client
doesn't use proxy so it was/is unnecessary in this case.

So I'm sorry, I don't think this is a proxy problem.

What I think is that the Local System content (service) call to
InternetGetConnectedState is prohibited (Access denied). This shouldn't be
proxy related as it is a call to the Win32 API?

I have read:
http://support.microsoft.com/kb/315035/en-us
but that didn't help. We have a default gateway.

Thanks for your input ... all input is appreciatad!

/Marcus
"Phil Wilson" wrote:
I know the documentation refers to the "system" being connected to the
internet, but it's my experience that some user-specific registry entries
are sometimes used, and the system account won't have them. Are there any
proxy servers involved? The system account will fail attempting to check a
proxy server but a user can be validated.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/1590592972
"EGON" <EG**@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.com...
Hi!

Thanks for your answer!
Are you using this syntax?
Yes, we do.

It works fine if we run "as user" (start exe manually) but if the exe run
as
"Local System" (started by the service / watchdog), it fails.

This only happens on a few computers (aprox ten). We have thousands of
computers where it works and only about ten where it fails.

Regards
/Marcus

"DailyCoder" wrote:
Are you using this syntax?

//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}

________________________
sa@dailycoding.com
http://www.dailycoding.com
DailyCoding.com - daily code for C#, .NET, ASP.NET, SQL


Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ryan Schefke | last post by:
------=_NextPart_000_0077_01C34C8B.2B90C960 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ..I just sent this out to the win32 distribution list but no one has...
5
by: Jim Andersen | last post by:
Hi, I made a DTS-package and it works when I execute it manually, but when it is run by the SQL Server Agent, it fails. I have use the guide to create a maintenance plan. That doesn't work so...
9
by: | last post by:
Hi All, I have allready tried to ask a similar question , but got no answer until now. In the meantime, I found, that I cannot understand some thread-settings for the Main() function . If I use...
12
by: Chad Crowder | last post by:
Hi all, I hope someone can give me a hand, because I'm out of ideas. I keep getting this message: Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET...
3
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that...
1
by: Duffman | last post by:
Hi, I have what seems to be a common problem, but the solutions I've found don't seem to work. I would like to use a web service to create a file at a UNC location in a shared file. Currently...
0
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
3
by: Simon | last post by:
Hi All, I'm hoping someone will have some words of wisdom for me regarding MS Clustering on Windows 2003. I have a service that runs on a cluster. During invocation it's supposed to...
1
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.