How to create URL from ASP.Net Web Form class name -


i have 2 classes inherit system.web.ui.page (two web pages) seen below.

~/catalogs/item.aspx.cs

public partial class item: system.web.ui.page {     protected global::system.web.ui.webcontrols.hyperlink downloadlink;      protected void page_load(object sender, eventargs e)     {         // expect "~/catalogs/download.aspx"         // how can implement method?         this.downloadlink.navigateurl = gettheurlfor(new download());     } } 

and

~/catalogs/download.aspx.cs

public partial class download : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         // perform download here     } } 

how can implement method gettheurlfor(page) return url given page?


update1: asp.net web application project on .net 4.5

update2: request.url not work because gets url of current page want url of different page

base on understanding of question, looking this?

namespace demowebform {     public partial class default : system.web.ui.page     {         protected void page_load(object sender, eventargs e)         {             var path = createpathfromtype(typeof (download));             var url = resolveurl(path);             downloadlink.navigateurl = url;         }          private string createpathfromtype(type type)         {             string fullname = type.fullname; // fullname : demowebform.catalogs.download             var path = request.applicationpath +                        fullname.replace("demowebform.", "").replace(".", "/") +                        ".aspx";             return path; // return value: /catalogs/download.aspx         }     } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -