Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6213013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:37:07+00:00 2026-05-24T06:37:07+00:00

I hope that I won’t start a topic that’s done already but I didn’t

  • 0

I hope that I won’t start a topic that’s done already but I didn’t find any proper answer here nor anywere else.
So here we go:
I use a WebClient to download HTML Code from a webpage, then I send a new request with that WebClient and the WebPage redirects me. Now I want to now where the Site has put me.

The WebClient Class itself doesn’t have any suitable properties, I already tried to rewrite the class so that I could get the Response URI but somehow it doesn’t work for wp7.

So any ideas how to get the URI where my WebClient got redirected? Or any idea why the application crashes when I want to use my own class:

    public class MyWebClient : WebClient
    {
            Uri _responseUri;

            public Uri ResponseUri
            {
                get { return _responseUri; }
            }
            protected override WebResponse GetWebResponse(WebRequest request, IAsyncResult result)
            {
                WebResponse response = base.GetWebResponse(request, result);
                _responseUri = response.ResponseUri;
                return response;
            }
        }
}

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:37:08+00:00Added an answer on May 24, 2026 at 6:37 am

    HttpWebRequest is the solution here, since WebClient is a wrapper around it anyway. Something like this should work for your specific situation:

    private HttpWebRequest request;
    private bool flagIt = true;
    
    public MainPage()
    {
        InitializeComponent();
    
        request = (HttpWebRequest)WebRequest.Create("http://google.com");
        request.BeginGetResponse(new AsyncCallback(GetData), request);
    }
    
    public void GetData(IAsyncResult result)
    {
        HttpWebRequest request = (HttpWebRequest)result.AsyncState;
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
    
        Debug.WriteLine(response.ResponseUri.ToString());
    
        if (flagIt)
        {
            request = (HttpWebRequest)WebRequest.Create("http://microsoft.com");
            request.BeginGetResponse(new AsyncCallback(GetData), request);
            flagIt = false;
        }
    }
    

    I am initiating the request in the main page constructor and then I am handling it in the callback. Notice how I am getting the ResponseUri – your final destination.

    You don’t need to handle AllowAutoRedirect if you don’t want blocking the redirect and simply getting the URL, like I am doing in the snippet above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My first post here...I hope that I don't brake any rules and if I
i hope that everyone here know the php 'variable variable' syntax: $color = 'red';
Is there any way (utilizing Reflection I hope) that I can make an instantiated
I thought I'd post here in the hope that maybe someone with MVVM expertise
Having read some postings here about this topic, I realize that there are quite
Hope that someone can share their experience with some of the latest emerging backbone.js
[I hope that this question is not too broad, I think that the subject
I hope that you can help me. When I want to execute those .bat
Not too sure how to formulate my question and I hope that this is
There is one thing I never understood about references and I hope that one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.