c# - ReportViewer control - axd url -
i've embedded microsoft.reporting.webforms.reportviewer
control in aspx. site works on mysite.com. when try exmple export report, there new black window opened address mysite.com/reserved.reportviewerwebcontrol.axd...
it's working fine. but.. pass axd via proxy. mean, i'd force export use url myproxy.mysite.com/reserved.reportviewerwebcontrol.axd...
redirect request mysite.com/reserved.reportviewerwebcontrol.axd...
i've noticed, link build within js (that inlcuded in axd):
exportreport: function(format) { if (this.exporturlbase == null) return false; window.open(this.exporturlbase + encodeuricomponent(format), "_blank"); return true; },
the url axd stored in exporturlbase
. how can change proxy serwer url?
it possible modify exporturlbase
field in javascript. report stored in placeholder somewhere on page, once found can create call _getinternalviewer() function on gain access exporturlbase. have @ following code:
function modifyexporturlbase() { var rv = null; var r = null; try { // report viewer rv = this.$find("ctl31"); r = rv._getinternalviewer(); } catch(err) { console.log(err) settimeout(modifyexportfilename, 2000) return; } if(r == null) { settimeout(modifyexportfilename, 2000); return; } else{ r.exporturlbase = "/yourproxypath" + r.exporturlbase } } modifyexporturlbase();
the timeouts necessary because reports received asynchronously , work once reports loaded.
the ctl31
found using inspect element feature on firebug check actual download link, there onclick method utilizes id of report on page. other sites have looked @ indicated may "reportviewer
" if using dynamic crm. easiest way find out check firebug or developer tools.
unfortunately not complete fix issue exporturlbase not store entire url, url relative domain, ie, exporturlbase = "reserved.reportviewerwebcontrol.axd..." not "www.yoursite.com/reserved.reportviewer..." however, once can change this, can create directory in inetpub folder new config , redirect link through folder use config.
sources:
http://reportsyouneed.com/ssrs-adding-date-to-exported-filenames/
Comments
Post a Comment