Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:07:53+00:00 2026-05-24T22:07:53+00:00

everyone, thank for your time. Well this my problem (well it’s not a probleam

  • 0

everyone, thank for your time.

Well this my problem (well it’s not a probleam at all), it is possible to have a class that inherits from ui.page and then instance an object of that class and do a redirect to it ?

Something like this:

Public sub myMethod() 
    Dim myPage as new myClassThatInheritsFromUIPage()
    Response.redirect(myPage) 'Here is one of my "no-idea" line
end sub

I do this in my webForm (and that what I want to do in a class that inherits from ui.page):

Response.BufferOutput = True  
Response.ClearContent()
Response.ClearHeaders()
ostream=crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat)
Response.AppendHeader("Cache-Control", "force-download")
Response.AppendHeader("Content-disposition","attachment;filename=ReportAsPDF.pdf")
Response.ContentType = "application/pdf"
Response.BinaryWrite(ostream.ToArray())
Response.Flush()  
HttpContext.Current.ApplicationInstance.CompleteRequest()

What I want to do is perfectly possible with a normal WebForm, but my webForm doesn’t render nothing at all (at least as (x)html so, that’s because I would like to know if what I’m asking is possible to achieve.

Thank you everyone.

Well at the end I just add “HttpContext.Current.” to all the lines that include a “response” attribute, so now I have just a class that NOT inherits from “UI.Page” and just call the method that clear the buffer (a custom method), add the headers (to force the download,set the mime type and filename) and flush the response by itself and get the effect/use I want it.

In order to access to the Session vars just add “HttpContext.Current.” and it works, I don’t know how secure or if is a good way,but appears to work well.

So the code now looks something like this:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource

Namespace foo
  Public Class requestReport


    'just to instance the object'
    Public Sub New()


    End Sub


    Public Sub downloadReport()
     'do all the stuff to connect and load the report'
         HttpContext.Current.Response.BufferOutput = True  
         HttpContext.Current.Response.ClearContent()
         HttpContext.Current.Response.ClearHeaders()
  ostream=crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat)
        HttpContext.Current.Response.AppendHeader("Cache-Control", "force-download")
        HttpContext.Current.Response.AppendHeader("Content-disposition","attachment;filename=ReportAsPDF.pdf")
        HttpContext.Current.Response.ContentType = "application/pdf"
        HttpContext.Current.Response.BinaryWrite(ostream.ToArray())
        HttpContext.Current.Response.Flush()  
        HttpContext.Current.ApplicationInstance.CompleteRequest()
     End Sub
   End Class 
 End Namespace

And from a command for example do this:

dim myReport as new foo.requestReport()
myReport.downloadReport() 

Of course now you can add more attributes or method if you need it.

So now I don’t even don’t use Response.redirect() or inherits from “UI.Page”, just a class that “change” the “current response” and “flush” the content created on fly with the crystal report, I think I was kind of totally lost but your answers really help me, especially what Tejs says, what is almost the same or the same what I just did. Thank you.

UPDATE:
By the way, I just realize that the ReportDocument class has this method: ExportToHttpResponse that let us flush the Crystal Report to the browser as PDF/XSL etc forcing (or not) the download of the file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:07:54+00:00Added an answer on May 24, 2026 at 10:07 pm

    Try just doing this instead:

    HttpContext.Current.Response.Redirect("...");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I would to thank everyone for all the help they provide via this
Thanks everyone for taking the time to read this. I have styled my navigation
Hello everyone and thank you very much for your time. Basically what I am
Hello everyone and thank you for your time. I would just like to say
thank you everyone for helping me out with this. i am new to ruby
http://min.us/muKpIB16z Is that zsh? Could somebody share the PS1 code to everyone :P? Thank
Thanks to everyone out there helping newbies like me. So far I have this:
This question has been answered. The problem was that myEventMoveTrainManaul() was being called from
I have this problem i cant workaround. I cache data in serialized format in
I have come across a very odd problem in C that I have never

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.