-
November 20th, 2008, 07:23 AM
#1
Senior Member
User/Pwd asked when displaying Image
Hi All
I am creating a web page, which will have a lot of images on it. The images are stored on my sharepoint site, are included on the page using the following html tag:
<img src="https:\\myshptserver.com\ImagesLib\img1.jpg" />
The page has almost 40 images coming from sharepoint, all with the similar kind of html tags as above.
Now, the problem comes when the page is render and the images are loaded...each image to be loaded, first asks the credentials of the sharepoint server (which is usual) and then the image loads...the problem is since i have 40 images, it asks me to enter 40 times for each image, so if a user opens my page, he'll get doomed.
So, I want to remove this problem, how can I do so??
Thanks
-
November 20th, 2008, 08:28 AM
#2
Originally Posted by codenamevirus
<img src="https:\\myshptserver.com\ImagesLib\img1.jpg" />
Slashes are the wrong way..
Now, the problem comes when the page is render and the images are loaded...each image to be loaded, first asks the credentials of the sharepoint server (which is usual) and then the image loads...the problem is since i have 40 images, it asks me to enter 40 times for each image, so if a user opens my page, he'll get doomed.
Check your browser settings. It should cache the first authentication and use that for the remainder of the session.
Oliver's Law:
Experience is something you don't get until just after you need it.
-
November 20th, 2008, 02:18 PM
#3
Senior Member
Originally Posted by SirDice
Slashes are the wrong way..
Check your browser settings. It should cache the first authentication and use that for the remainder of the session.
Thanks for your answer. Maybe, I wasnt clear enough.
My site is open to all the public, and the password to the images wont be available to anyone except me, since I am the admin.
So, if anyone in this world, opens my site, I dont want that user/pwd prompt to show up at all, instead the user should be able to see all the images without any prompts, like it was viewing a normal site.
What I want is, a guidance how in asp.net or c#, can I add in the code, that will prevent all these prompts from coming at all.
Thanks
-
November 20th, 2008, 03:22 PM
#4
Ah.. Check the ACLs on the files, as this is usually the problem with IIS. Or it's a setting in sharepoint, I don't know enough about sharepoint to guide you.
Oliver's Law:
Experience is something you don't get until just after you need it.
-
November 20th, 2008, 06:33 PM
#5
Originally Posted by codenamevirus
So, I want to remove this problem, how can I do so??
Thanks
good luck with that
Is your sharepoint site windows auth or forms based?
It's sharepoint...it needs credentials but if it's windows auth, you might be able to trick it through IIS, but forms based auth, you might be able to pass credentials in through a web interface first. Have tried a few things like that and it turned into a major pain in the arse!
Never got it to work 100% forms based. IIS about 90% of the time
09:F9:11:02:9D:74:E3:5B 8:41:56:C5:63:56:88:C0
-
November 20th, 2008, 10:19 PM
#6
Check to ensure that the local userid that is defined for anonymous access has read access to the folder (as well as its content) that contains the images.
The userid is usually IUSR_servername. You can check by going to IIS, right click the virtual directory of the site, select the Directory Security tab. Ensure Anonymous access is selected and note the userid.
Then right click the folder that contains the images and ensure this userid has read access to the folder. Also check the privs on the actual images. They should be same. If not, there is an option at the folder level to propagate the settings to the contents of the folder.
That should do it.
Alternatively, you could impersonate by setting the user and pass in the webconfig. google impersonate IIS. There are several entries on MS Technet that show you how.
Last edited by Cheap Scotch Ron; November 20th, 2008 at 10:33 PM.
Reason: Other idea
-
November 22nd, 2008, 06:41 AM
#7
Senior Member
Originally Posted by SirDice
Ah.. Check the ACLs on the files, as this is usually the problem with IIS. Or it's a setting in sharepoint, I don't know enough about sharepoint to guide you.
ACLs, whats that? and how and what should I check in them?
Originally Posted by dinowuff
Is your sharepoint site windows auth or forms based?
It's sharepoint...it needs credentials but if it's windows auth, you might be able to trick it through IIS,
The web application that I have created uses form based authentication but the sharepoint site that I use, has windows based authentication, I know that I need pass the credentials, but how do I do it while accessing the images, so that the user doesnt see the authentication dialog boxes. Please see that I am using the full URL of the image in the <img src="full url of the image from shpt">, so please let me know how to proceed in this direction.
Originally Posted by Cheap Scotch Ron
Check to ensure that the local userid that is defined for anonymous access has read access to the folder (as well as its content) that contains the images.
The userid is usually IUSR_servername. You can check by going to IIS, right click the virtual directory of the site, select the Directory Security tab. Ensure Anonymous access is selected and note the userid.
Then right click the folder that contains the images and ensure this userid has read access to the folder. Also check the privs on the actual images. They should be same. If not, there is an option at the folder level to propagate the settings to the contents of the folder.
That should do it.
Alternatively, you could impersonate by setting the user and pass in the webconfig. google impersonate IIS. There are several entries on MS Technet that show you how.
The problem with sharepoint sites is you cant find out where's the physical folder, where the images are actually stored by sharepoint, as far as enabling the anonymous access, I'll check the folder permissions setting on shpt, and see if it helps from there. The Permissions setting includes what users are allowed to access the folder and what kind of access should be given, so guess thats what you want me try, right?
-
November 22nd, 2008, 01:24 PM
#8
Impersonate using credentials that sharepoint will allow to access the images.
Basically, you are going to store the credentials in the web.config and use them when accessing the url on the sharepointserver.
See a more detailed example here:
http://www.microsoft.com/technet/pro....mspx?mfr=true
-
November 23rd, 2008, 07:20 PM
#9
Senior Member
Originally Posted by Cheap Scotch Ron
Impersonate using credentials that sharepoint will allow to access the images.
Basically, you are going to store the credentials in the web.config and use them when accessing the url on the sharepointserver.
See a more detailed example here:
http://www.microsoft.com/technet/pro....mspx?mfr=true
Tried that...still getting the same error. I think its because the request for the images is sent from the client machine when the page is getting rendered, rather than the server where the application is hosted. So, I guess impersonation is not the solution.
-
November 24th, 2008, 03:03 PM
#10
codenamevirus:
Following Cheap Scotch Ron link, impersonation is probably the only way you're going to "fool" your form based app.
ASP impersonation isn't the easiest or cleanest way to do things, but then share point work "out of the box" and really doesn't work when you modify anything.
I'm out on this one. Sorry I can't help any more. Honestly the way I handle these situations is to keep mucking about with IIS and ASP until I get it right.
09:F9:11:02:9D:74:E3:5B 8:41:56:C5:63:56:88:C0
Similar Threads
-
By shakuni in forum Cryptography, Steganography, etc.
Replies: 2
Last Post: February 16th, 2008, 11:01 AM
-
By valhallen in forum AntiOnline's General Chit Chat
Replies: 1
Last Post: March 15th, 2005, 06:36 AM
-
By gore in forum Operating Systems
Replies: 3
Last Post: March 7th, 2004, 08:02 AM
-
By GreekGoddess in forum The Security Tutorials Forum
Replies: 19
Last Post: August 28th, 2003, 06:07 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|