Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Response.End() doesnResponse.End() doesn't stop processing script?
Previous
 
Next
New Post
4/18/2008 1:24 PM
 

I've develop a module that will offer RSS xml file on fly when user click the  icon. What I want is a page showing items in XML format. Just like what I can get in the Blog Module. Here is what I did, I create a user control StoryFeed.ascx, which inherites from class DotNetNuke.Entities.Modules.PortalModuleBase.  Here is my code in StoryFeed.ascx .cs.

protected void Page_Load(object sender, EventArgs e)

{

    //Get data from database, put them in a RssChannel class 
    RssChannel rss = GetChannel(); 
   
    Response.Clear();
    Response.ClearContent();
    Response.ContentEncoding = System.Text.Encoding.UTF8;
    Response.ContentType = "application/xml";

    //Using XmlTextWriter to output the result  
    rss.Write(Response.OutputStream);
   
    //End processing of the script
    Response.End();

}

However, I can't see it in the xml format because after the "<rss>....</rss>" text, there followed "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">....". It seems the Response.End() doesn't stop processing the script. How can I stop process the pipeline after I retrieved data and output them to the stream? I googled on Response.End() and found a piece on Rick Strahl's blog, I tried CompleteRequest() but no luck.

Anyone have the same problem? Need help on this.

 

 

 

 

 
New Post
4/18/2008 2:07 PM
 

Hi Cynthia,

Nothing immediate jumps out at me, but I'll take a stab in the dark -- do you perhaps also need a Response.ClearHeaders() call when reseting the response buffer?

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
4/18/2008 2:31 PM
 

Brandon,

I tried add Response.ClearHeaders() but no luck. Here is what I did,

 

{

    ....

                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();            
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.ContentType = "text/xml";                  


                rss.Write(Response.OutputStream);
               
                Response.End(); 

}

 

And this is what I got,

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource 'http://localhost/dnn40/Mymodule/tabi...

</rss><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
----------------^
protected void Page_Load(object sender, EventArgs e)

 
New Post
4/19/2008 2:51 PM
 

Hi Cynthia,

Even as I wrote my response I couldn't help but think a ClearHeaders() call probably wouldn't do much good. 

Is the DOCTYPE declaration the only tag that's causing your page problems, or only the first?  If you were to toggle the DOCTYPE visibility (via Default.ascx.vb), would that (temporarily) rectify the problem, or would the next tag in line cause yet another problem?

The reason I ask is because, if the problem is only with the DOCTYPE, you might be able to just band-aid in fix.  If not, the solution will likely be more involved.

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
5/12/2008 6:28 AM
 

Hi Cynthia,

Did you work out how to do this? 

I'm having the same difficulty!

Thanks,

Richard

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Response.End() doesnResponse.End() doesn't stop processing script?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out