asp.net mvc 2 - Render Partial of same name as parent View - Crashes WebDev.WebServer40.exe -
I'm wondering if other people are having the same problem or it's just me!
I have a View Purchases.aspx
and a partial view purchases.ascx
:
within Purchases.aspx
If I do html.RenderPartial ("Purchase")
then WebDev.WebServer40.exe basically stops.
I think this is due to a stack overflow because RenderPartial
can not determine what to do (.aspx or .ascx).
Is this a bug, is it a defined behavior, or what is happening to me?
This behavior is defined because ViewLocationFormats and PartialViewLocationFormats are defined as follows and an aspx page is first Will be seen.
see lockdown format = new [] {"~ / views / {1} / {0} .aspx", "~ / view / {1} / {0} .ascx" "~ / Scene / share / {0} .a spx", "~ / scene / share / {0} .ascx"}; Partial view location formats = sub-resolution formatting;
Partial view location formats should exclude ASPX definitions in my opinion. This can be solved by overriding the default WebFormViewengine. Note, you must register it in Application_Start ()
method
public class ASPXViewEngine: [WebFormViewEngine {public ASPXViewEngine {{base.PartialViewLocationFormats = new string []. {"~ / Scene / {1} / {0} .ascx", "~ / scene / share / {0} .ascx"}; Base.AreaPartialViewLocationFormats = new string [] {"~ / regions / {2} / view / {1} / {0} .ascx", "~ / regions / {2} / view / share / {0} .ascx" ,}; }}
Comments
Post a Comment