We have a page https://www.giftstoindia24x7.com/Article.aspx which is built in Asp.Net and has a url with the .aspx extension https://www.giftstoindia24x7.com/articles/when-is-mothers-day-2020.aspx. We have started shifting our project to Asp.Net Mvc. and we need to transfer this url to https://www.giftstoindia24x7.com/a/when-is-mothers-day-2020 extension less url and Also the internally there will multiple pages in response to a .net request. I have tried the global.asax for this but not working. Can anyone help me with this?
- private void Application_BeginRequest(object sender, EventArgs e)
- {
- string fullOrigionalpath = Request.url.tostring();
- string NewUrl = getUrl(fullOrigionalpath);
- Context.RewritePath(NewUrl);
- }
And the getUrl method looks like
- private string getUrl(string inputUrl)
- {
- string returnURL="https://www.giftstoindia24x7.com/article?id=";
- if(inputUrl=='https://www.giftstoindia24x7.com/a/mothers-day-usa-vs-uk')
- returnURL=returnURL+"1";
- return returnURL;
- }