I have a scenario where I map the url on a page and of URL maps with redirect URL in database then I redirect it to the new URL mapped for redirect.
if (vURL == ds.Tables[0].Rows[0]["New_URL"].ToString())
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.Redirect(ds.Tables[0].Rows[0]["Actual_URL"].ToString());
}
With the above code lets us say if I mapped URL abc with abc1 it will work first time. However, if I updated the same record and map abc with abc1NewURL then it still redirect abc1, it somehow caches the URL.
Is there a way I can stop this caching or redirect URL in asp.net webform?
If you're going to change the target of a redirect, you should send a HTTP 302 ("Found" / "Moved permanently") redirect, as browsers cache HTTP 301 redirects.
If it's just for testing and the 301 is the response you want to send, you'll need to clear the cached redirect(s) from your browser to follow the changed redirect.