Proper Location of Files

Discussion in 'ASP .Net' started by Bryan Masephol, Jan 5, 2004.

  1. I've been getting myself fimiliar with ASP.Net and C# and am trying to read
    my database connection infomation from an xml preference file that is
    located on the web server. I just built a simple web app and can execute
    the test page I made with the hard coded db values and everything works
    fine. When I swap in my code for reading from the xml preference file I get
    an error saying the xml document that I'm reading with is null.

    So I pulled out all the code to and made a test program to test my xml
    reading code locally and it worked fine... so I'm thinking that its not
    finding the xml file and then xml document is never built and is null.

    So I thought I would write out a little test txt file from within my web
    application to find out what directory the code was looking in for my xml
    preference file.... but I am not able to find this file.

    If I have my index.aspx file in the folder race...

    /race/index.aspx

    and I tell it to just

    XmlTextReader reader = new XmlTextReader("DBConnection.xml");

    and I have the file

    /race/DBConnection.xml

    in that location shouldn't it work?

    Thanks for any input

    Bryan
     
    Bryan Masephol, Jan 5, 2004
    #1
    1. Advertising

  2. Bryan,

    One thing to check is if the ASPNet user account has access to the file
    location. If the ASPNet user account doesn't have access to the file then
    you may experience this error.

    Try wrapping the file access line in a Try/Catch to see if you can capture
    the actual error. I'm betting that it's a permissions issue.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Bryan Masephol" <> wrote in message
    news:...
    > I've been getting myself fimiliar with ASP.Net and C# and am trying to

    read
    > my database connection infomation from an xml preference file that is
    > located on the web server. I just built a simple web app and can execute
    > the test page I made with the hard coded db values and everything works
    > fine. When I swap in my code for reading from the xml preference file I

    get
    > an error saying the xml document that I'm reading with is null.
    >
    > So I pulled out all the code to and made a test program to test my xml
    > reading code locally and it worked fine... so I'm thinking that its not
    > finding the xml file and then xml document is never built and is null.
    >
    > So I thought I would write out a little test txt file from within my web
    > application to find out what directory the code was looking in for my xml
    > preference file.... but I am not able to find this file.
    >
    > If I have my index.aspx file in the folder race...
    >
    > /race/index.aspx
    >
    > and I tell it to just
    >
    > XmlTextReader reader = new XmlTextReader("DBConnection.xml");
    >
    > and I have the file
    >
    > /race/DBConnection.xml
    >
    > in that location shouldn't it work?
    >
    > Thanks for any input
    >
    > Bryan
    >
    >
     
    S. Justin Gengo, Jan 5, 2004
    #2
    1. Advertising

  3. Thanks for the reply Justin

    Problem is that I don't see an ASPNet user account on my web server (win
    2003). Shouldn't one have been setup when I configured ASP.Net on the
    server?

    Thanks
    Bryan

    "S. Justin Gengo" <> wrote in message
    news:...
    > Bryan,
    >
    > One thing to check is if the ASPNet user account has access to the file
    > location. If the ASPNet user account doesn't have access to the file then
    > you may experience this error.
    >
    > Try wrapping the file access line in a Try/Catch to see if you can capture
    > the actual error. I'm betting that it's a permissions issue.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Bryan Masephol" <> wrote in message
    > news:...
    > > I've been getting myself fimiliar with ASP.Net and C# and am trying to

    > read
    > > my database connection infomation from an xml preference file that is
    > > located on the web server. I just built a simple web app and can

    execute
    > > the test page I made with the hard coded db values and everything works
    > > fine. When I swap in my code for reading from the xml preference file I

    > get
    > > an error saying the xml document that I'm reading with is null.
    > >
    > > So I pulled out all the code to and made a test program to test my xml
    > > reading code locally and it worked fine... so I'm thinking that its not
    > > finding the xml file and then xml document is never built and is null.
    > >
    > > So I thought I would write out a little test txt file from within my web
    > > application to find out what directory the code was looking in for my

    xml
    > > preference file.... but I am not able to find this file.
    > >
    > > If I have my index.aspx file in the folder race...
    > >
    > > /race/index.aspx
    > >
    > > and I tell it to just
    > >
    > > XmlTextReader reader = new XmlTextReader("DBConnection.xml");
    > >
    > > and I have the file
    > >
    > > /race/DBConnection.xml
    > >
    > > in that location shouldn't it work?
    > >
    > > Thanks for any input
    > >
    > > Bryan
    > >
    > >

    >
    >
     
    Bryan Masephol, Jan 5, 2004
    #3
  4. Bryan,

    If your app runs the account has to be there.

    In Computer Management - Local Users and Groups - Users folder

    It is specifically:

    Name: ASPNET

    Full Name: ASP.NET Machine Account

    Description: Account used for running the ASP.NET worker process
    (aspnet_wp.exe)

    If you don't see that account then I can't imagine how your app could be
    running on the server.

    That said, there are specific ways to set up a domain account which can be
    used to run the ASP.NET worker process with. (We're doing that at the
    company I work full time at. It's more secure.)

    I would check to see if you aren't running a domain account. If so that
    account would need to be given permissions to the file.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Bryan Masephol" <> wrote in message
    news:...
    > Thanks for the reply Justin
    >
    > Problem is that I don't see an ASPNet user account on my web server (win
    > 2003). Shouldn't one have been setup when I configured ASP.Net on the
    > server?
    >
    > Thanks
    > Bryan
    >
    > "S. Justin Gengo" <> wrote in message
    > news:...
    > > Bryan,
    > >
    > > One thing to check is if the ASPNet user account has access to the file
    > > location. If the ASPNet user account doesn't have access to the file

    then
    > > you may experience this error.
    > >
    > > Try wrapping the file access line in a Try/Catch to see if you can

    capture
    > > the actual error. I'm betting that it's a permissions issue.
    > >
    > > --
    > > Sincerely,
    > >
    > > S. Justin Gengo, MCP
    > > Web Developer / Programmer
    > >
    > > Free code library at:
    > > www.aboutfortunate.com
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > >
    > >
    > > "Bryan Masephol" <> wrote in message
    > > news:...
    > > > I've been getting myself fimiliar with ASP.Net and C# and am trying to

    > > read
    > > > my database connection infomation from an xml preference file that is
    > > > located on the web server. I just built a simple web app and can

    > execute
    > > > the test page I made with the hard coded db values and everything

    works
    > > > fine. When I swap in my code for reading from the xml preference file

    I
    > > get
    > > > an error saying the xml document that I'm reading with is null.
    > > >
    > > > So I pulled out all the code to and made a test program to test my xml
    > > > reading code locally and it worked fine... so I'm thinking that its

    not
    > > > finding the xml file and then xml document is never built and is null.
    > > >
    > > > So I thought I would write out a little test txt file from within my

    web
    > > > application to find out what directory the code was looking in for my

    > xml
    > > > preference file.... but I am not able to find this file.
    > > >
    > > > If I have my index.aspx file in the folder race...
    > > >
    > > > /race/index.aspx
    > > >
    > > > and I tell it to just
    > > >
    > > > XmlTextReader reader = new XmlTextReader("DBConnection.xml");
    > > >
    > > > and I have the file
    > > >
    > > > /race/DBConnection.xml
    > > >
    > > > in that location shouldn't it work?
    > > >
    > > > Thanks for any input
    > > >
    > > > Bryan
    > > >
    > > >

    > >
    > >

    >
    >
     
    S. Justin Gengo, Jan 5, 2004
    #4
  5. Thanks for all the help.

    After messing around some more with accounts I was able to get it to work.
    I didn't have read access on the directory that I was trying to read from
    for the Account that was running the ASP.NET worker process. Thanks for you
    help!

    Bryan
     
    Bryan Masephol, Jan 6, 2004
    #5
    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. Luke Dalessandro
    Replies:
    0
    Views:
    634
    Luke Dalessandro
    Jan 15, 2006
  2. zxo102
    Replies:
    0
    Views:
    450
    zxo102
    Aug 1, 2006
  3. Mohammad Khan
    Replies:
    3
    Views:
    136
    Tom Copeland
    Jan 10, 2006
  4. saiho.yuen
    Replies:
    3
    Views:
    553
    kaeli
    Sep 14, 2004
  5. John Bailo

    IE7 shows location even if location=no

    John Bailo, Jan 19, 2007, in forum: Javascript
    Replies:
    4
    Views:
    219
    OmegaJunior
    Mar 11, 2007
Loading...

Share This Page