Denying unauthenticated access to a .txt file

Discussion in 'ASP .Net' started by Penguini, Dec 3, 2007.

  1. Penguini

    Penguini Guest

    I have a website using c# and .Net 2. I have two .txt files placed in
    a subfolder that I need to protect. The site is protected by Forms
    Authentication, and the files are inside a folder that is set to deny
    anonymous access. When run locally on my machine, this all works fine;
    typing the full path of one of the text files redirects the user to
    the login screen as expected. However, when I publish the website to a
    webserver, typing the full path simply opens the text file in an IE
    window - no redirection takes place. How can I stop this? Any help
    greatfully received!
    Penguini, Dec 3, 2007
    1. Advertisements

  2. Peter Bromberg [C# MVP], Dec 3, 2007
    1. Advertisements

  3. Penguini

    Penguini Guest

    Thanks, I have added the .txt extension to be handled by ASP.NET, as
    having the files in another folder is not an option in this case.
    Problem sorted, thanks again!
    Penguini, Dec 3, 2007
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.