A way to figure out redirection URL

后端 未结 2 1533
萌比男神i
萌比男神i 2020-12-11 04:05

Given a URL A which gets redirected to a 3rd party website B, in my application I need to to find out URL B for the given url A and insert it in DB , this can be a windows

2条回答
  •  一整个雨季
    2020-12-11 04:52

    Uri MyUrl = Request.UrlReferrer;
    Response.Write("Referrer URL Port: " + Server.HtmlEncode(MyUrl.Port.ToString()) + "
    "); Response.Write("Referrer URL Protocol: " + Server.HtmlEncode(MyUrl.Scheme) + "
    ");

    As what I understand from your question you can use a code like this so you can see the previous url and save it into db by using Linq or other ADO.NET methods.

    I assume that you know how to save record in db with LINQ. If you don't please follow this link : LINQ to SQL - 5 Minute Overview

    Hope it helps.

提交回复
热议问题