473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with security

I have this code running

Dim strFileName As String = txtFile.PostedFile.FileName.Trim

Try

If txtFile.PostedFile.ContentType.ToString = "image/pjpeg" Then

' strFileName = txtFile.PostedFile.FileName.Trim()

strFileName = Path.GetFileName(strFileName)

strFileName = Server.MapPath("images") & "\" & strFileName

txtFile.PostedFile.SaveAs(strFileName)

'RaiseEvent UploadComplete()

Else

lblMessage.Visible = True

lblMessage.Text = "File type MUST be in jpeg(jpg) format."

End If

Catch ex As Exception

Me.Visible = False

Response.Write(ex.Message)

End Try

But it produces an access denied error. I have this line in my web.config

<identity impersonate="true"/>

Any Ideas?

Thanks


Nov 18 '05 #1
2 876
With impersonation set to true, but no username or password identified, the machine will attempt to write to the system as the IUSR_machinename account. If you are listing a username/password, make sure that account has write access to the file system
Nov 18 '05 #2
If you're not using basic authentication, then when you set
impersonate="true" in Web.Config, the request will be running under
the IUSR_MachineName user.

You need to give this user NTFS write permission to the folder where
the file is being saved.

Tommy,

"Mark" <vb********@cableone.net> wrote in message news:<eU**************@TK2MSFTNGP11.phx.gbl>...
I have this code running

Dim strFileName As String = txtFile.PostedFile.FileName.Trim

Try

If txtFile.PostedFile.ContentType.ToString = "image/pjpeg" Then

' strFileName = txtFile.PostedFile.FileName.Trim()

strFileName = Path.GetFileName(strFileName)

strFileName = Server.MapPath("images") & "\" & strFileName

txtFile.PostedFile.SaveAs(strFileName)

'RaiseEvent UploadComplete()

Else

lblMessage.Visible = True

lblMessage.Text = "File type MUST be in jpeg(jpg) format."

End If

Catch ex As Exception

Me.Visible = False

Response.Write(ex.Message)

End Try

But it produces an access denied error. I have this line in my web.config

<identity impersonate="true"/>

Any Ideas?

Thanks

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Alistair | last post by:
hello again oh knowledgable ones Today I took the plunge (more like a hell-hole dive) and upgraded to windows XP Pro.. and as I expected things are slightly different... what I didn't...
2
by: epaetz | last post by:
I'm getting Not associated with a trusted SQL Server connection errors on a .Net windows service I wrote, when it's running on my application server. It's not a problem with mixed mode...
5
by: lappy | last post by:
Hello, I have written a small programme to compact an access 97 database. Dim je As New JRO.JetEngine ' Compacts database Data.Mdb to Data2.mdb. je.CompactDatabase...
7
by: c duden | last post by:
I am attempting to encrypt some text and be able to decrypt it at a later time. I have two methods to do this: public static Byte EncryptText(string textToEncrypt, string encryptionHash) {...
3
by: Michael Rodriguez | last post by:
I have a web service that I am calling by digitally signing the message with WSE 2.0 SP2. It runs fine on my PC. I uploaded the WS to our server, and if I call that from my PC that also works...
5
by: Bob N | last post by:
I have an ASP.NET web page -- several auto-post back DropDownLists that perform a query against a relatively large database (3 to 4 seconds delay) that repopulate a couple of datagrids, comboboxes...
10
by: Bryce Calhoun | last post by:
Hello, First of all, this is a .NET 1.1 component I'm creating. SUMMARY ----------------------- This component that I'm creating is, for all intents and purposes, a document parser (I'm...
0
by: Budhi Saputra Prasetya | last post by:
Hi, I still have the same problem with embedding Windows Control. I'll just requote what I posted last time: I managed to create a Windows Form Control and put it on my ASP .NET page. I...
9
by: Ron | last post by:
New discovery. If I take a perfectly good database, and "compact/repair" on it with Access 2000 (seems to be at multiple sites--I've tried it with my system here, at another office on an...
5
by: VictorG | last post by:
Hello, I am trying to secure a webservice using WSE 3.0 and the turnkey usernameForCertificateSecurity profile. I am passing a valid username token, and on the server I have overridden the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.