Question : Urgent System.UnauthorizedAccessE<wbr />xception

Hi I have the following environment setup: on IIS server Anynomous user is checked (the account we used an account that has permission set on sql server example Corp\nxxyr password myPassword )  and also we have intergrated windows security checked.
On web.config we use impersonate =true.

The website have a part where a user uploads a file to the server (we also have a line of code that saves just the uploaded filePath to the DataBase). on the Server the upload folder is a shared folder out side of wwwroot. When ever the upload code gets executed  the windows identity will changed to  NT AUTHORITY\NETWORK SERVICE and the following exception is logged(P.S I think though not sure once the identity  NT AUTHORITY\NETWORK SERVICE the application loosed its impersonated account that allows it to insert record to the db fails as well)

Full Exception:
   

An exception of type 'System.UnauthorizedAccessException' occurred and was caught.

----------------------------------------------------------------------------------

12/10/2009 13:31:41

Type : System.UnauthorizedAccessException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message : Access to the path '\\MyServer\FileUploads\InData.txt' is denied.

Source : mscorlib

Help link :

Data : System.Collections.ListDictionaryInternal

TargetSite : Void WinIOError(Int32, System.String)

Stack Trace :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

   at System.IO.FileStream..ctor(String path, FileMode mode)

   at System.Web.HttpPostedFile.SaveAs(String filename)

   at   BusiEntity.FileUploader.UploadAndSaveFile(HtmlInputFile aFile, Int64 incNum)

 

Additional Info:

 

MachineName : MyServer

TimeStamp : 12/10/2009 7:31:41 PM

FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

AppDomainName : /LM/W3SVC/1/ROOT/Tracker3-1-129049467531758316

ThreadIdentity :

WindowsIdentity : NT AUTHORITY\NETWORK SERVICE

 

Category: General

Priority: 2

EventId: 102

Severity: Error

Title: Tracker

Machine: MyServer

App Domain: /LM/W3SVC/1/ROOT/Tracker3-1-129049467531758316

ProcessId: 6420

Process Name: c:\winnt\system32\inetsrv\w3wp.exe

Thread Name:

Win32 ThreadId:5880

Extended Properties:

--> MachineName: MyServer

--> TimeStamp: 12/10/2009 7:31:42 PM

--> FullName: Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

--> AppDomainName: /LM/W3SVC/1/ROOT/Tracker3-1-129049467531758316

--> WindowsIdentity: NT AUTHORITY\NETWORK SERVICE

 

Exception Information Details:

======================================

Exception Type: System.Data.SqlClient.SqlException

Errors: System.Data.SqlClient.SqlErrorCollection

Class: 14

LineNumber: 65536

Number: 18456

Procedure:

Server:DataBaseServer

State: 1

Source: .Net SqlClient Data Provider

ErrorCode: -2146232060

Message: Login failed for user 'CORP\MyServer'.

Data: System.Collections.ListDictionaryInternal

TargetSite: Void OnError(System.Data.SqlClient.SqlException, Boolean)

HelpLink: NULL

 

StackTrace Information Details:

======================================

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)

   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)

   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)

   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

   at System.Data.SqlClient.SqlConnection.Open()

   at Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener.ExecuteStoredProcedure(LogEntry logEntry)

   at Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)

   at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)

   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)

Category:

Priority: -1

EventId: 6352

Severity: Error

Title:

Machine: MyServer

Application Domain: /LM/W3SVC/1/ROOT/Tracker3-1-129049467531758316

Process Id: 6420

Process Name: c:\winnt\system32\inetsrv\w3wp.exe

Win32 Thread Id: 5880

Thread Name:

Extended Properties:

 

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Answer : Urgent System.UnauthorizedAccessE<wbr />xception

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Foster+Jackson / Music from the Heart and Soul</title> 
<script type="text/javascript" src="swfobject.js"></script> 
<script type="text/javascript">
window.onload = function()
{
	var so = new SWFObject("FosterandJackson.swf", "sotester", "100%", "100%", "8", "#deb644");
	so.addVariable("flashVarText", "this is passed in via FlashVars for example only");
	so.addParam("scale", "noscale");
					so.addParam("salign", "t");
	so.write("flashcontent");
                
};
</script>
</head>
      <body bgcolor="#deb644" leftmargin="center" topmargin="0" borders="0">
<div id="flashcontent"> 
               <strong></strong>             
<div id="container"align="center">
 <div id="mainContent"><a href="http://get.adobe.com/flashplayer" target="_blank" /a>
 <img src="fosterandjacksonsplash.jpg" width="1256" height="864" />
 </div>
</div>
</div>
</body>
</html>
Random Solutions  
 
programming4us programming4us