How to get full referer url like host name path name?
help me please.
Thanks.
How to get full referer url like host name path name?
help me please.
Thanks.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 30, 2023, 5:54 AM EDT
Hello Subrat,
Please try below one,
using Microsoft.AspNetCore.Http; public void GetRefererUrl(HttpContext context) { var referer = context.Request.Headers["Referer"].ToString(); var uri = new Uri(referer); var hostName = uri.Host; var pathName = uri.AbsolutePath; var queryParameters = uri.Query; }You can refer this link to get httpcontext in .net core,
https://www.c-sharpcorner.com/blogs/getting-host-information-from-current-the-url-in-asp-net-core-31
Rajkiran SwainRank #165 · 14.4K reputationPosted Mar 30, 2023, 9:50 AM EDT
javascript var fullUrl = document.referrer; console.log(fullUrl); csharp string fullUrl = Request.UrlReferrer.ToString(); Console.WriteLine(fullUrl);