c# - How to have Autofac inject properties upon loading a web forms page in an iframe with Server.Transfer? -


edit: does work when page retrieved request.redirect(), problem appearing when iframe navigated server.transfer(). preferably i'd not ad hoc change every reference server.transfer() in application response.redirect(), since don't know interchangeable

i working legacy web forms application lot of global variables, god classes, etc , first thing i've been trying improve in factoring out methods specific classes/interfaces , adding dependency injection alongside that. app works loading in main.aspx page contains iframe loads subsequent pages. have found injection doesn't happen when page loaded within iframe though works fine externally.

every page, including main.aspx, derives "projectbasepage" although doesn't seem issue.

main.aspx:

<iframe id="webservername" src="" scrolling="no" frameborder="0" style="border:0px;height:13px;width:50px;vertical-align:bottom;"></iframe> 

overview.aspx.cs

[injectproperties] public partial class overview : projectbasepage {     public itablerepository tablerepo { get; set; } 

global.asax

static icontainerprovider _containerprovider;          public icontainerprovider containerprovider         {             { return _containerprovider; }         }          protected void application_start(object sender, eventargs e)         {             var builder = new containerbuilder();             builder.registertype<tablerepository>().as<itablerepository>();              _containerprovider = new containerprovider(builder.build());         } 

and that's it, nothing complex @ all. works fine if manually "inject" in page_load or setting property myself, don't know autofac tripping because of iframe loading , don't have enough experience it. i'd love convert iframe master page or instead that's bit more work can take on myself @ time.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -