Can't find my images folder - why?

Discussion in 'ASP .Net' started by LP, Mar 6, 2008.

  1. LP

    LP Guest

    Hi there,

    Sorry if this is a little off-topic here but can anyone explain why, when I
    launch my website from within VS, it can find my image files ok when they're
    in the root like so:

    <img src="Test.jpg">
    <img src="http://localhost:3932/WebSite/Test.jpg">

    but can't find them in "App_Data" if I try either of the following instead
    (nor any other subfolder for that matter - it even defers to the "Alt"
    attribute if I add it).

    <img src="App_Data\Test.jpg">
    <img src="http://localhost:3932/WebSite/App_Data/Test.jpg">

    The file is definitely present in "App_Data". Thanks in advance.
    LP, Mar 6, 2008
    #1
    1. Advertising

  2. LP

    Phil Johnson Guest

    I think your slashes should be forward, not back. Give that a try and see if
    it works.
    --
    Regards,

    Phillip Johnson (MCSD For .NET)
    PJ Software Development
    www.pjsoftwaredevelopment.com


    "LP" wrote:

    > Hi there,
    >
    > Sorry if this is a little off-topic here but can anyone explain why, when I
    > launch my website from within VS, it can find my image files ok when they're
    > in the root like so:
    >
    > <img src="Test.jpg">
    > <img src="http://localhost:3932/WebSite/Test.jpg">
    >
    > but can't find them in "App_Data" if I try either of the following instead
    > (nor any other subfolder for that matter - it even defers to the "Alt"
    > attribute if I add it).
    >
    > <img src="App_Data\Test.jpg">
    > <img src="http://localhost:3932/WebSite/App_Data/Test.jpg">
    >
    > The file is definitely present in "App_Data". Thanks in advance.
    >
    >
    >
    Phil Johnson, Mar 6, 2008
    #2
    1. Advertising

  3. LP

    LP Guest

    >I think your slashes should be forward, not back. Give that a try and see
    >if
    > it works.


    Already tried it with no effect. Note that the "http" example should work
    however. I did find at least one other web posting reporting the same
    problem but no solution. Any other ideas? Thanks.
    LP, Mar 6, 2008
    #3
  4. LP

    Mufaka Guest

    LP wrote:
    >> I think your slashes should be forward, not back. Give that a try and see
    >> if
    >> it works.

    >
    > Already tried it with no effect. Note that the "http" example should work
    > however. I did find at least one other web posting reporting the same
    > problem but no solution. Any other ideas? Thanks.
    >
    >

    I am guessing that the App_Data folder is protected against http
    requests because of the files that are supposed to be stored there.
    Mufaka, Mar 6, 2008
    #4
  5. LP

    LP Guest

    > I am guessing that the App_Data folder is protected against http requests
    > because of the files that are supposed to be stored there.


    The problem exists regardless of the folder. In any case, I considered
    security issues but I already tried testing it under an admin account and
    even gave the IUSR account full rights (since I've set things up for
    impersonation in my "web.config" file). I also tried launching it directly
    from my browser via "localhost" where it should definitely run as IUSR
    AFAIK. Something appears seriously broken here. I'm going to try testing
    this on Win2003 Server to see what happens but I need to get it working on
    my development box. Anyway, thanks for your help.
    LP, Mar 6, 2008
    #5
  6. LP

    LP Guest

    > I am guessing that the App_Data folder is protected against http requests
    > because of the files that are supposed to be stored there.


    >> I am guessing that the App_Data folder is protected against http requests
    >> because of the files that are supposed to be stored there.
    >>

    > The problem exists regardless of the folder. In any case, I considered
    > security issues but I already tried testing it under an admin account and
    > even gave the IUSR account full rights (since I've set things up for
    > impersonation in my "web.config" file). I also tried launching it directly
    > from my browser via "localhost" where it should definitely run as IUSR
    > AFAIK. Something appears seriously broken here. I'm going to try testing
    > this on Win2003 Server to see what happens but I need to get it working on
    > my development box. Anyway, thanks for your help.


    Ok, you must have been right. I stopped and restarted "aspnet_regiis.exe"
    and now I can't access it in the "app_data" folder (as you said) but I can
    access it everywhere else again. Go figure. That's fine though since I
    wanted to store it in an "images" folder to begin with. Thanks for your
    help. Appreciated.
    LP, Mar 6, 2008
    #6
  7. LP

    kpg* Guest

    "LP" <no_spam@_nospam.com> wrote in
    news::

    >> I am guessing that the App_Data folder is protected against http
    >> requests because of the files that are supposed to be stored there.

    >
    > The problem exists regardless of the folder. In any case, I considered
    > security issues but I already tried testing it under an admin account
    > and even gave the IUSR account full rights (since I've set things up
    > for impersonation in my "web.config" file). I also tried launching it
    > directly from my browser via "localhost" where it should definitely
    > run as IUSR AFAIK. Something appears seriously broken here. I'm going
    > to try testing this on Win2003 Server to see what happens but I need
    > to get it working on my development box. Anyway, thanks for your help.


    Are you using any access restrictions in the web.config file?

    Until a user is authenticated they cannot access restricted folders.

    And I agree with the last poster...I would not put images in the App_Data
    folder.
    kpg*, Mar 6, 2008
    #7
  8. LP

    LP Guest

    >>> I am guessing that the App_Data folder is protected against http
    >>> requests because of the files that are supposed to be stored there.

    >>
    >> The problem exists regardless of the folder. In any case, I considered
    >> security issues but I already tried testing it under an admin account
    >> and even gave the IUSR account full rights (since I've set things up
    >> for impersonation in my "web.config" file). I also tried launching it
    >> directly from my browser via "localhost" where it should definitely
    >> run as IUSR AFAIK. Something appears seriously broken here. I'm going
    >> to try testing this on Win2003 Server to see what happens but I need
    >> to get it working on my development box. Anyway, thanks for your help.

    >
    > Are you using any access restrictions in the web.config file?


    None

    >
    > Until a user is authenticated they cannot access restricted folders.


    Well, I'm fairly new to web programming but from what I've read, IUSR is
    first routed through IIS as an anonymous user (since I have anonymous access
    turned on) but I've also set "<identity impersonate="true" /> in my root's
    "web.config" file. This should ensure my app is in fact running under the
    IUSR account instead of the ASPNET account on my XP box ("Network Service"
    under Win2003 Server). I don't know why it can't access "App_Data" however
    since I've given IUSR the proper rights. As "Mufaka" alluded to in his post,
    it looks like there's some other security issue at play (related to special
    folders like "App_Data") but I can't find the details so far.
    >
    > And I agree with the last poster...I would not put images in the App_Data
    > folder.


    I had no plans to but was just testing there when I couldn't get it working
    anywhere else. Terminating and then restarting "aspnet_regiis.exe" fixed
    that however as per my last post (for IE anyway - Firefox still refuses to
    work in the VS environment but it does work outside of VS - go figure).
    LP, Mar 6, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    4
    Views:
    894
    Eliyahu Goldin
    Jan 4, 2005
  2. ABC
    Replies:
    7
    Views:
    820
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    878
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,840
    Smokey Grindel
    Dec 2, 2006
  5. madhu
    Replies:
    0
    Views:
    414
    madhu
    Oct 5, 2006
Loading...

Share This Page