[Mono-devel-list] asp.net usercontrols and WriteFile features

Joe Audette joe_audette at yahoo.com
Sun Mar 20 16:21:53 EST 2005


I could be wrong on this but I have always thought
that Response.WriteFile is for writing binary streams
to the response like to support file downloads and
such. I would not have thought it would be used in the
Render method of a user control.

If I was retrieving content from a text file to write
to the response my first inclination would be to open
the file server side and then write the contents using
Response.Write or to load the content into a Literal
then load that into the user control or some container
control using this.Controls.Add instead of overriding
the render method. 

The file you are loading is labelled .html, if you
have  the full set of html tags, head, body etc in
that file you're likely to have problems putting that
in a user control because those tags would already be
part of the containing page.

Hope any of that helps,

Joe


--- charlie <monodevellist at charlie.at> wrote:
> Hi Guys,
> 
> i have been doing a bit of asp.net programming and
> have run into a few
> features :-). here a code snippet of what I am
> doing:
> 
> Menu.ascx
>   public class Menu : System.Web.UI.UserControl
>   {
> 
>     private void Page_Load(object sender,
> System.EventArgs e)
>     {
>     }
>     protected override void Render(HtmlTextWriter
> output)
>     {
> #if __MonoCS__
>      
>
Response.WriteFile("/home/[absolutepath]/html/Menu.html");
> #else
>       Response.WriteFile("../html/Menu.html");
> #endif
>     }
> 
> Prod.aspx
>   <body>
>     <gutschn:Menu id="Menu1"
> runat="server"></gutschn:Menu>
> 
> 
> - Response.WriteFile under MS works relative to the
> as?x file that
> contains it, but apparently not so in mono. Thus
> under IIS including
> this webcontrol where both aspx and ascx file are in
> cgi-bin, pulls in
> the the afore mentioned html file from the parallel
> html directory. I
> was able to counter with with #if, not nice, but it
> works
> 
> - UserControl.Render under mono executes to a
> different time than under
> IIS. In IIS the 'included' html gets written where
> the control is,
> whereas under mono the html gets written before the
> output of the aspx
> file. Thus I have my meta-tags, menu and footer and
> then comes the
> <!DOCTYPE and the rest of the page :-(
> 
> 
> Has anyone had similar experiences ??
> 
> current system is suse 9.2, apache2 and the 1.1.4 /
> 1.0.6 mix that one
> gets off the mono-project homepage
> rpm -qa | grep mono
> mono-data-1.1.4-1.ximian.10.1
> mono-winforms-1.1.4-1.ximian.10.1
> mono-basic-1.1.4-1.ximian.10.1
> mono-data-oracle-1.1.4-1.ximian.10.1
> mono-data-sqlite-1.1.4-1.ximian.10.1
> mono-ikvm-1.1.4-1.ximian.10.1
> mod_mono-1.0.6-1.ximian.9.1    (now 1.0.7)
> mono-devel-1.1.4-1.ximian.10.1
> mono-core-1.1.4-1.ximian.10.1
> mono-web-1.1.4-1.ximian.10.1
> mono-extras-1.1.4-1.ximian.10.1
> mono-data-postgresql-1.1.4-1.ximian.10.1
> mono-data-sybase-1.1.4-1.ximian.10.1
> mono-locale-extras-1.1.4-1.ximian.10.1
> mono-complete-1.1.4-1.ximian.10.1
> mono-jscript-1.1.4-1.ximian.10.1
> 
> mod_mono.so has since been replaced with a svn 1.0.7
> compile from source
> to take advantage of multiple named applications
> (works like a charm
> *g*, multiple virtual servers with their own
> applications)
> 
> regards
>   charlie
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
>
http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 

joe_audette at yahoo.com
http://www.joeaudette.com
http://www.mojoportal.com



More information about the Mono-devel-list mailing list