It's always better to generate a URL using “Url. Action” method to avoid URL issues. When Deploying application from one environment to other environments, it may not necessary to have a same website configuration on IIS. Means, On development you may have a virtual directory structure is “www.test.com/application/results” but in other environments, it configured as ““www.test.com/websitename/application/results” so we need to consider all these Directory structures when we are generating URL otherwise we run into issues. URL. Action method will take care of these things so it is a good idea to use URL. Action method to avoid URL issues
Example: Url.Action("results", "Application", new { id = Model.id })
No comments:
Post a Comment