简体   繁体   中英

Facing Issue with using System.Web.Routing

I am using slideshow on my website. Its works fine when i disable the web routing. When i enable the Web Routing on aspx pages, Slideshow working stops. I guess javascript not working after enabling Web routing.

 protected void Application_Start(object sender, EventArgs e)
 {
       RegisterRoutes(RouteTable.Routes);
 }

  public static void RegisterRoutes(RouteCollection routes)
 {
    routes.MapPageRoute("CategoryRoute", "Category/{sCatId}", "~/Category.aspx",true);
    routes.MapPageRoute("SubCategoryRoute", "SubCategory/{catid}",   "~/SubCategory.aspx");
 }

Routing works fine when i am using it, but working slideshow stops. Below i am pasting slideshow code.

<div id="slider">
            <div id="items">
                <div>
                    <div style="width: 100%; margin: 0 0; height: 250px">
                        <img src="http://www.yepme.com/slider/1.jpg" alt="" width="100%" height="100%" />
                    </div>
                </div>
                <div>
                    <div style="width: 100%; margin: 0 0; height: 250px">
                        <img src="http://www.yepme.com/slider/2.jpg" alt="" width="100%" height="100%" />
                    </div>
                </div>
                <div>
                    <div style="width: 100%; margin: 0 0; height: 250px;">
                        <img src="http://www.yepme.com/slider/3.jpg" alt="" width="100%" height="100%" />
                    </div>
                </div>
                <div>
                    <div style="width: 100%; margin: 0 0; height: 250px;">
                        <img src="http://www.yepme.com/slider/4.jpg" alt="" width="100%" height="100%" />
                    </div>
                </div>

            </div>
</div>

Don't know what the problem is ? how it can be resolved.

I also used

<img src= '<%= Page.ResolveUrl("http://www.yepme.com/slider/4.jpg") %>' alt="" width="100%" height="100%" />

But it didn't work for me. Guys Help me !

Are your jpeg files delivered through a custom handler ?

If so, did you try adding some specific ignore for your slideshow ? Something like :

public static void RegisterRoutes(RouteCollection routes)
{

 routes.Ignore("{*sliderimages}", new { sliderimages =@"slider/\d+\.jpg"});

 routes.MapPageRoute("CategoryRoute", "Category/{sCatId}", "~/Category.aspx",true);
 routes.MapPageRoute("SubCategoryRoute", "SubCategory/{catid}",   "~/SubCategory.aspx");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM