How to check if loggedin user can access another internal site in asp.net RRS feed

  • Question

  • Hi Team,

    i need to check if logged in user (Windows users) have access to a particular site from another site (both are intranet).

    i am using below code i am using in my application, but it always throwing exception 403 forbidden error. i can access the site that i am trying from browser.

    var request = (HttpWebRequest)WebRequest.Create("My Application url here");
    request.UseDefaultCredentials = true;
    request.Proxy.Credentials = CredentialCache.DefaultCredentials;
    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) // here 403 forbidden exception throwing.
    int statusCode = (int)response.StatusCode;

    any help on this would be appreciated highly.

    • Moved by CoolDadTx Tuesday, May 26, 2020 1:35 PM ASP.NET related
    Tuesday, May 26, 2020 10:12 AM

All replies

  • Hello,

    The site for ASP.NET questions is here https://forums.asp.net/

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Tuesday, May 26, 2020 12:37 PM