Post Image Data to Server from embedded user control in IE
Post Image Data to Server from embedded user control in IE
am 24.02.2006 19:47:27 von VancouverMike
Hi,
I have a user control embedded into web browser(IE 6.0) for scanning image
from a scanner. When the image is scanned, I want to upload this image to
server side by using HttpPost class(a third party class, not from .NET
Framework directly), within the user control. It seems that I am getting
security problems. In IIS, when I turn on "Integrated Windows authentication"
and turn off "Anonymous access" option, the PostData method of HttpPost class
doesn't work. When I turn on "Anonymous access" option in IIS, along with
"Integrated Windows authentication" option on, it works. How can I use
HttpPost without compromising my security settings in IIS.
Enviroment I am using:
Windows XP Pro
Visual Studio 2003
ASP.NET 1.1 with C#
..NET Framework 1.1
The code for uploading image is shown as below:
------------------------------------------------------
HttpPost objPost = new HttpPost();
System.Drawing.Bitmap imgID = new Bitmap(IDImage.Image);
// Add the image to the form data collection.
objPost.FormData.Add("image1", imgID);
try
{
string ret = objPost.PostData("http://Localhost/IDImaging/Web/Save.aspx") ;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
---------------------------------------------------------
When the PostData doesn't work, I don't get any error either.
Another problem is when I put the user control in my web form, I cannot
debug the user control, even I use Project reference in my web form project.
Any idea why?
Thanks,
Mike
RE: Post Image Data to Server from embedded user control in IE
am 27.02.2006 06:39:59 von v-yren
Hi Mike,
Thanks for posting!
Based on experience, the current issue is caused that the user has no
enough NTFS permission for the specific folder when the "Integrated Windows
Authentication" is used.
This means if the application runs well when "Enable Anonymous Access" is
checked, the IUSR account has NTFS permission for the specific folder which
the file is saved in.
>"the PostData method of HttpPost class doesn't work."
Are there any errors occur? I mean whether there are some error messages.
If this is true, please post these messages here. This will help us figure
out more details.
In addition, if you want to set the folder security, I recommend you follow
the steps below:
1 Uncheck the "Enable Anonymous Access" option in IIS MMC;
2 Right click the specific folder and choose the "Properties";
3 In the "Security" tab, click the "Add" button and input the name of user
who you want to grant the permission in the text box;
4 In the "Permissions for Administrators" list please check the "Write"
option for the user who is added before;
5 Click "OK" button and restart the IIS.
Then, please test again and find out whether the problem still occurs.
I appreciate your understanding!
Regards,
Yuan Ren [MSFT]
Microsoft Online Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
RE: Post Image Data to Server from embedded user control in IE
am 06.03.2006 19:49:30 von VancouverMike
Hi Yuan Ren,
Thanks for your reply. Actually I didn't get any error message. I couldn't
figure it out, so I tried to use WebClient class from .NET Framework
directly. It still didn't work but I got security error message saying
something not authorized. Then I set the WebClient object Credentials
property to be "DefaultCredentials", shown as follows, then it works. I don't
understand why. Could you explain?
WebClient objSender = new WebClient();
objSender.Credentials = System.Net.CredentialCache.DefaultCredentials;
Thanks,
Mike
------------------------------------------------------------ -----------
""Yuan Ren[MSFT]"" wrote:
> Hi Mike,
>
> Thanks for posting!
>
> Based on experience, the current issue is caused that the user has no
> enough NTFS permission for the specific folder when the "Integrated Windows
> Authentication" is used.
>
> This means if the application runs well when "Enable Anonymous Access" is
> checked, the IUSR account has NTFS permission for the specific folder which
> the file is saved in.
>
> >"the PostData method of HttpPost class doesn't work."
> Are there any errors occur? I mean whether there are some error messages.
> If this is true, please post these messages here. This will help us figure
> out more details.
>
> In addition, if you want to set the folder security, I recommend you follow
> the steps below:
>
> 1 Uncheck the "Enable Anonymous Access" option in IIS MMC;
> 2 Right click the specific folder and choose the "Properties";
> 3 In the "Security" tab, click the "Add" button and input the name of user
> who you want to grant the permission in the text box;
> 4 In the "Permissions for Administrators" list please check the "Write"
> option for the user who is added before;
> 5 Click "OK" button and restart the IIS.
>
> Then, please test again and find out whether the problem still occurs.
>
> I appreciate your understanding!
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
> ======================================================
> PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
> updated on February 14, 2006. Please complete a re-registration process
> by entering the secure code mmpng06 when prompted. Once you have
> entered the secure code mmpng06, you will be able to update your profile
> and access the partner newsgroups.
> ======================================================
> When responding to posts, please "Reply to Group" via your newsreader
> so that others may learn and benefit from this issue.
> ======================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> ======================================================
>
>
RE: Post Image Data to Server from embedded user control in IE
am 07.03.2006 12:52:44 von v-yren
Hi Mike,
Thanks for your reply!
From your description, I think the current issue is caused that the
credential was not passed in the application before setting credential
explicitly. Unlike IE browser, the credential is not passed automatically
in our own application although the "Integrated windows authentication" has
been used. The following document gives us more explanation about the
current issue:
http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/cpref/html/
frlrfsystemnetcredentialcacheclassdefaultcredentialstopic.as p
Thanks for your understanding!
Regards,
Yuan Ren [MSFT]
Microsoft Online Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================