Mayukh Sen

Mayukh Sen

  • NA
  • 48
  • 437

Need help for redirecting pages from asp.net to MVC

Apr 20 2020 11:10 AM
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?
  1. private void Application_BeginRequest(object sender, EventArgs e)  
  2. {  
  3.     string fullOrigionalpath = Request.url.tostring();  
  4.     string NewUrl = getUrl(fullOrigionalpath);        
  5.     Context.RewritePath(NewUrl);  
  6. }  
And the getUrl method looks like 
  1. private string getUrl(string inputUrl)  
  2. {  
  3.     string returnURL="https://www.giftstoindia24x7.com/article?id=";  
  4.     if(inputUrl=='https://www.giftstoindia24x7.com/a/mothers-day-usa-vs-uk')  
  5.         returnURL=returnURL+"1";  
  6.     return returnURL;  
  7. }  
 

Answers (1)