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

you defined the function but didn't invoke it.  try this:
1:
2:
3:
4:
5:
6:
con_mc.onRelease = function() {
        var lvSend:LoadVars = new LoadVars();
        var lvReceive:LoadVars = new LoadVars();
        lvSend.sendAndLoad("../php/visit.php?pageviewed="+sURL, lvReceive, "POST");
        getURL(sURL, _blank);
};
Random Solutions  
 
programming4us programming4us