Gurpreet Gill
Gurpreet Gill

Reputation: 174

How to do GetRouteUrl?

I want open "aspnet.pdf" file but in url show "Report.pdf" do not show the original file name on url please help me how i can do this. This is on click event

 dr.Read();
                 filePath = dr[1] + ".pdf";
                 string fn = Server.MapPath("~/" + filePath);
                 string s = GetRouteUrl("lst", new { type = "Report.pdf" });
                 Response.Redirect(s);

this is in Global.asax

void reg_route(System.Web.Routing.RouteCollection rc)
    {
        filePath = "aspnet.pdf";
        rc.MapPageRoute("lst", "{type}", "~/"+filePath);
    }

This is give error

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Requested URL: localhost:2127/Report.pdf

Physical Path: C:...\WebSites\GetScheduled\Report.pdf

Upvotes: 1

Views: 679

Answers (0)

Related Questions