impersonate and upload file

AgnesPandaEyes

New member
Joined
Dec 27, 2007
Messages
3
Programming Experience
1-3
I have the following code that saves a file to local server, but I need to save it to a remote server while impersonating just during the file save and copy to temp table to a sql server. I tried impersonating in the web.config file but that impersonates for the whole website and the impersonation doesn't exist for this application. I only want to impersonate during the this process. Any help would be great thanks.


VB.NET:
Dim MyPostedFile As HttpPostedFile = MyFileColl.Get(0)
MyPostedFile.SaveAs("C:\Inetpub\wwwroot\PCMS\Uploads\" & filename)
'Create our connection strings
Dim sExcelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\Inetpub\wwwroot\PCMS\Uploads\" & filename & ";Extended Properties=""Excel 8.0;HDR=YES;"""
Dim sSQLConnectionString As String = AppSettings("DBConnectProd")

Try
    'Copy Excel File to Temp Table 
    Dim OleDbConn As OleDbConnection = New OleDbConnection(sExcelConnectionString)
    Dim OleDbCmd As OleDbCommand = New OleDbCommand(("SELECT NETWORK_ID, TRANSACTION_DATE, DATE_POSTED_CMS, REJECT_CODE, CMS_ADJ_DESC, CMS_AMOUNT  FROM " & sWorkBook), OleDbConn)
    OleDbConn.Open()
 
Back
Top