Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: User/Pwd asked when displaying Image

  1. #1
    Senior Member codenamevirus's Avatar
    Join Date
    Jun 2005
    Location
    Faridabad, Haryana, India
    Posts
    298

    Question 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
    CodeNameVirus

  2. #2
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Quote Originally Posted by codenamevirus View Post
    <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.

  3. #3
    Senior Member codenamevirus's Avatar
    Join Date
    Jun 2005
    Location
    Faridabad, Haryana, India
    Posts
    298
    Quote Originally Posted by SirDice View Post
    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
    CodeNameVirus

  4. #4
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    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.

  5. #5
    THE Bastard Sys***** dinowuff's Avatar
    Join Date
    Jun 2003
    Location
    Third planet from the Sun
    Posts
    1,253
    Quote Originally Posted by codenamevirus View Post
    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:5B8:41:56:C5:63:56:88:C0

  6. #6
    AO's Filibustier Cheap Scotch Ron's Avatar
    Join Date
    Nov 2008
    Location
    Swamps of Jersey
    Posts
    378
    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

  7. #7
    Senior Member codenamevirus's Avatar
    Join Date
    Jun 2005
    Location
    Faridabad, Haryana, India
    Posts
    298
    Quote Originally Posted by SirDice View Post
    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?

    Quote Originally Posted by dinowuff View Post
    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.

    Quote Originally Posted by Cheap Scotch Ron View Post
    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?
    CodeNameVirus

  8. #8
    AO's Filibustier Cheap Scotch Ron's Avatar
    Join Date
    Nov 2008
    Location
    Swamps of Jersey
    Posts
    378
    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

  9. #9
    Senior Member codenamevirus's Avatar
    Join Date
    Jun 2005
    Location
    Faridabad, Haryana, India
    Posts
    298
    Quote Originally Posted by Cheap Scotch Ron View Post
    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.
    CodeNameVirus

  10. #10
    THE Bastard Sys***** dinowuff's Avatar
    Join Date
    Jun 2003
    Location
    Third planet from the Sun
    Posts
    1,253
    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:5B8:41:56:C5:63:56:88:C0

Similar Threads

  1. Basic Image stegnographer v 0.1
    By shakuni in forum Cryptography, Steganography, etc.
    Replies: 2
    Last Post: February 16th, 2008, 11:01 AM
  2. Changing Broken Image image on Firefox
    By valhallen in forum AntiOnline's General Chit Chat
    Replies: 1
    Last Post: March 15th, 2005, 06:36 AM
  3. The history of the Mac line of Operating systems
    By gore in forum Operating Systems
    Replies: 3
    Last Post: March 7th, 2004, 08:02 AM
  4. Protecting Yourself From Image Theft
    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
  •