473,756 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

InternetGetConn ectedState 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
InternetGetConn ectedState gets FALSE back (even when there is a connection)
and when i check GetLastError it says 5=Access denied, that
InternetGetConn ectedState got Access denied and thereby returns false (I
assume).

Summery:
-So it seems like the app gets Access denied when it tries to call
InternetGetConn ectedState when app runs as Local System account.
-If we remove the call to InternetGetConn ectedState 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 2660
Are you using this syntax?

//Creating the extern function...
[DllImport("wini net.dll")]
private extern static bool InternetGetConn ectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToIn ternet( )
{
int Desc ;
return InternetGetConn ectedState( 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("wini net.dll")]
private extern static bool InternetGetConn ectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToIn ternet( )
{
int Desc ;
return InternetGetConn ectedState( 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**@discussio ns.microsoft.co mwrote in message
news:A7******** *************** ***********@mic rosoft.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("wini net.dll")]
private extern static bool InternetGetConn ectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToIn ternet( )
{
int Desc ;
return InternetGetConn ectedState( out Desc, 0 ) ;
}

______________ __________
sa@dailycoding. com
http://www.dailycoding.com
DailyCoding.co m - 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
InternetGetConn ectedState 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**@discussio ns.microsoft.co mwrote in message
news:A7******** *************** ***********@mic rosoft.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("wini net.dll")]
private extern static bool InternetGetConn ectedState( out int
Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToIn ternet( )
{
int Desc ;
return InternetGetConn ectedState( 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
3395
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 replied.can someone on this list please help? The issue should be trivial for experienced MySQL users, I'm just a novice, thanks!
5
13718
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 good either. It runs Optimizations, but not integrity checks or backups (probably because integrity checks failed). The following from the log file:
9
6331
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 the attribute for the Main() function, I get "access denied error", if I use a ManagementEventWatcher to connect to the local machine to receive events. Is there anybody out there, how possibly can explain why this happens?? If I remove this...
12
5101
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 Files\projects_cig\e4e3b3da\3c20ac69" is denied. The error goes on to say that the ASP.NET is not authorized...
3
8008
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 libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
1
8136
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 I'm just running it locally and saving the file locally using my machines UNC path. I have given user ASPNET full control over the folder I want to write the file to. I've also tried using the web config identity impersonation to use my user...
0
6741
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 (1.1 does not support running a process as a different user). I'm running everything on Windows Server 2003. I have impersonation enabled in my web.config, and I'm using Integrated authentication on the IIS virtual directory that this aspx is in....
3
5427
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 determine from the cluster which node is active (this is a active/standby configuration) and either proceed or sleep depending on the status. The interface to the cluster is that advertised by the standard interop layer built by Visual Studio for the...
1
8993
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 which is a webserver running Win2k3 with IIS6, my domain account is a local administrator on this machine. The web app I am running is trying to write a file to ServerB which is also a Win2k3 machine. On the folder of the machine I am writing to...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.