Search:
Namespaces
Discussions
.NET v1.1
Feedback
Asp.Net Permission Issue with Sockets
Messages
Related Types
This message was discovered on
ASPFriends.com 'ngfx-io' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Kloberg Mac (LAM) (VIP)
I'm trying to ping a router in ASP.NET and use System.Net.Sockets to do
this, however I get the following error:
Exception Details: System.Net.Sockets.SocketException: An attempt was made
to access a socket in a way forbidden by its access permissions
Source Error:
Line 18: Dim socket As
Socket
= New
Socket
(
AddressFamily
.InterNetwork,
SocketType
.Raw,
ProtocolType
.Icmp)
Stack Trace:
[
SocketException
(0x271d): An attempt was made to access a socket in a way
forbidden by its access permissions]
System.Net.Sockets.
Socket
..ctor(
AddressFamily
addressFamily,
SocketType
socketType,
ProtocolType
protocolType) +142
I suspect that this has something to do with the ASP.NET account, which
permission or policy do I need to give it to make this work?
TIA
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
Reply to this message...
Mitch Denny (VIP)
Mac,
Under IIS 5.0, ASP.NET applications execute with the Full Trust
permission set and is only constrained by the rights of the
ASPNET account. I can't imagine what is stopping you unless it
is something in the OS user rights which is blocking you.
Have you attempted to execute the code within an console
application running with administrator privs?
----------------------------------------
- Mitch Denny
-
Click here to reveal e-mail address
- +61 (414) 610-141
-
-----Original Message-----
From: Kloberg Mac (LAM) [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, 25 June 2002 23:41
To: ngfx-io
Subject: [ngfx-io] Asp.Net Permission Issue with Sockets
I'm trying to ping a router in ASP.NET and use System.Net.Sockets to do
this, however I get the following error:
Exception Details: System.Net.Sockets.SocketException: An attempt was
made to access a socket in a way forbidden by its access permissions
Source Error:
Line 18: Dim socket As
Socket
= New
Socket
(
AddressFamily
.InterNetwork,
SocketType
.Raw,
ProtocolType
.Icmp)
Stack Trace:
[
SocketException
(0x271d): An attempt was made to access a socket in a
way forbidden by its access permissions]
System.Net.Sockets.
Socket
..ctor(
AddressFamily
addressFamily,
SocketType
socketType,
ProtocolType
protocolType) +142
I suspect that this has something to do with the ASP.NET account, which
permission or policy do I need to give it to make this work?
TIA
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
| [ngfx-io] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-io.asp
= JOIN/QUIT
Reply to this message...
Kloberg Mac (LAM) (VIP)
When I run the same thing from a WinForm with my local user account (member
of Administrators), it works fine. I already checked the permission sets in
the Framework Configuration, but everywhere I look it says "Grant assemblies
unrestricted access to sockets". I even tried to give the Asp.Net account
the "Act as part of the Operating System" privilege. Nothing seems to work,
I keep getting the same error: "System.Net.Sockets.SocketException: An
attempt was made to access a socket in a way forbidden by its access
permissions".
Any other Ideas?
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
[Original message clipped]
Reply to this message...
Jose Fuentes
I have one idea.
on the server in administrative tools you have a item there called ".net
framework configuration"
In there you have runtime security policys
you may have to adjust an app's permisions or the zone security.
Hope that helps.
Joe
-----Original Message-----
From: Kloberg Mac (LAM) [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, June 26, 2002 8:44 AM
To: ngfx-io
Subject: [ngfx-io] RE: Asp.Net Permission Issue with Sockets
When I run the same thing from a WinForm with my local user account (member
of Administrators), it works fine. I already checked the permission sets in
the Framework Configuration, but everywhere I look it says "Grant assemblies
unrestricted access to sockets". I even tried to give the Asp.Net account
the "Act as part of the Operating System" privilege. Nothing seems to work,
I keep getting the same error: "System.Net.Sockets.SocketException: An
attempt was made to access a socket in a way forbidden by its access
permissions".
Any other Ideas?
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
[Original message clipped]
| [ngfx-io] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-io.asp
= JOIN/QUIT
Reply to this message...
Kloberg Mac (LAM) (VIP)
Yep, I went there already and all settings where "Grant assemblies
unrestricted access to sockets". Still the same error though...
Also, if the problem was there, it wouldn't work at all. I can run the same
code in a winforms application without a problem. It only throws the error
in an ASP.Net application.
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
[Original message clipped]
Reply to this message...
Mitch Denny (VIP)
Mac,
I did a bit of investigation and I am afraid that you are
not going to like the news. It looks like the limitation
is behavior by design and that only user accounts that are
members of the Administrators group have rights to access
the raw sockets implementation.
http://support.microsoft.com/default.aspx?scid=kb
;EN-US;q170591
If you quickly add the ASPNET account to the administrators
group then re-start IIS you will notice everything starts
working very nicely.
They do specify a rather drastic work around in this
knowledge base article, but I'm not going to do it for
obvious security reasons.
http://support.microsoft.com/default.aspx?scid=kb
;en-us;Q195445
They also talk about a work around in a DLL called icmp.dll
so you could possibly export the functions in there.
----------------------------------------
- Mitch Denny
-
Click here to reveal e-mail address
- +61 (414) 610-141
-
-----Original Message-----
From: Kloberg Mac (LAM) [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, 26 June 2002 22:44
To: ngfx-io
Subject: [ngfx-io] RE: Asp.Net Permission Issue with Sockets
When I run the same thing from a WinForm with my local user account
(member of Administrators), it works fine. I already checked the
permission sets in the Framework Configuration, but everywhere I look it
says "Grant assemblies unrestricted access to sockets". I even tried to
give the Asp.Net account the "Act as part of the Operating System"
privilege. Nothing seems to work, I keep getting the same error:
"System.Net.Sockets.SocketException: An attempt was made to access a
socket in a way forbidden by its access permissions".
Any other Ideas?
--
Sincerely,
Mac Kloberg
LIEBHERR AMERICA INC.
http://www.liebherr.com
[Original message clipped]
| [ngfx-io] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-io.asp
= JOIN/QUIT
Reply to this message...
System.Net.Sockets.AddressFamily
System.Net.Sockets.ProtocolType
System.Net.Sockets.Socket
System.Net.Sockets.SocketException
System.Net.Sockets.SocketType
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com