You must Sign In to post a response.
  • Category: ASP.NET

    Path issue in url routing mechanism for webforms application.

    Hi,

    when i am using routing mechanism for web forms application.
    In my application have a master page, in that master page has the below reference.

    <script src="../foldername/js/star-rating.js" type="text/javascript"></script>

    when i am changing the route of that master page contained subpage, that path is converted into the below format.

    http://applicationname/urlroutename/foldername/js/star-rating.js

    In the above link that "urlroutename" additionally added, when i am using the routing mechanism.

    Please give me the advise how to rectify that problem.


    Thanks in advance.
  • #767175
    simply use below method for routing
    First add a method to the Global.asax file for adding routes, in global.asax add following things

    < %@ Import Namespace="System.Web.Routing" %>
    //After the Session_End method, add the following code:
    void RegisterRoutes(RouteCollection routes)
    {
    }
    //In the Application_Start method, call RegisterRoutes as shown in the following example
    void Application_Start(object sender, EventArgs e)
    {
    RegisterRoutes(RouteTable.Routes);
    }

    for more details switch to below links
    https://msdn.microsoft.com/en-us/library/dd329551(v=vs.100).aspx

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


  • Sign In to post your comments