ASP.NET and Security Issues with WebClient

Discussion in 'ASP .Net' started by kellygreer1, Mar 4, 2008.

  1. kellygreer1

    kellygreer1 Guest

    I have a ASP.NET WebSite running on IIS6 on Windows 2003.
    I'd like to have the Default.aspx page be able to web scrape a page
    from the same site "data.ashx".
    I'd like to keep everything NT Authentication.

    Nothing I try seems to work. I always get a 401 authorization error.
    Here is what I have tried.
    1) WebClient
    2) WebClient + new Credentials
    3) WebClient + Impersonation in web.config
    4) Application Pool with Network Identity - and then I get Service
    Unavailable on my site.


    What is the correct way to do this? Either a WebClient call or a Soap
    call to the same server or remote with NT Authentication. I can't
    seem to figure out why I get the 401 error and no idea how to
    troubleshoot or solve.

    Kelly Greer

    change nospam to yahoo
    kellygreer1, Mar 4, 2008
    1. Advertisements

  2. I have not attempted anything like this with an ashx. I have used asmx files
    in the same project (as an experiment, as I see no reason to involve the
    HTTP stack for something that is local (If I needed both in the same
    project, the ASMX would be used remote and the class files locally).

    WIth your project, I assume the ASHX has a purpose for external clients. If
    not, I would not keep it as your data access method. Even if so, I would
    refactor the actual data access methods to a class rather than leave in the
    ASHX and call this class directly for local access of the data. It makes it
    easier to unit test, as well.
    Cowboy \(Gregory A. Beamer\), Mar 5, 2008
    1. Advertisements

  3. kellygreer1

    kellygreer1 Guest

    It has an external purpose only.
    I was experimenting with some REST (ROA) concepts.

    I do the same when doing asmx.... I just use the class when working

    Ran into same kind of issue again today on Windows 2003 ...Two sub-
    sites - one an application / the other a web service
    Both virtual directories - set as applications with anonymous client
    When the App calls the Web Service I get a 401 error. Arghhh!!!
    I thought it was anonymous authentication? Can someone else try this
    out and tell me I'm not crazy?
    I was using a WCF-based .svc service here.

    kellygreer1, Mar 5, 2008
    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.