I am getting a little further, but still having issues...

Discussion in 'ASP .Net' started by Brent White, Oct 26, 2005.

  1. Brent White

    Brent White Guest

    If you need more information, I'd be glad to give it, but I am
    developing an ASPX page so that the user can select multiple values for
    a specific field, then pass them on (using Crystal Reports 10 on a
    separate ASP page). Here is the code behind the button that will
    launch the report (is in a file called StateSelect.aspx.vb:

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Button2.Click
    Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    End Sub


    When I launch the ASP page and hit the submit button, I get the
    following error in the IE window:

    Server Error in '/NEWCrystalReports' Application.
    --------------------------------------------------------------------------------

    Error executing child request for /NewCrystalReports/genericreport.asp.

    Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Error executing child
    request for /NewCrystalReports/genericreport.asp.

    Source Error:


    Line 40:
    Line 41: Protected Sub Button2_Click(ByVal sender As Object, ByVal
    e As System.EventArgs) Handles Button2.Click
    Line 42:
    Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    Line 43: End Sub
    Line 44: End Class


    Source File: c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb
    Line: 42

    Stack Trace:


    [HttpException (0x80004005): Error executing child request for
    /NewCrystalReports/genericreport.asp.]
    System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
    TextWriter writer, Boolean preserveForm, String path, String filePath,
    String physPath, Exception error, String queryStringOverride) +3137343
    System.Web.HttpServerUtility.Execute(String path, TextWriter writer,
    Boolean preserveForm) +722
    System.Web.HttpServerUtility.Transfer(String path, Boolean
    preserveForm) +55
    _Default.Button2_Click(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb:42
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    eventArgument) +78

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    +33
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +5670




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50215.44;
    ASP.NET Version:2.0.50215.44





    There is this line in the ASPX file itself:

    <form method="post" id="form1" runat="server"
    action="GenericReport.asp">





    The server is running ASP.NET v2 (Windows 2003 Server with IIS 6) and I
    am developing in VS .NET 2005.
     
    Brent White, Oct 26, 2005
    #1
    1. Advertising

  2. Brent,

    I'm pretty certain that you can't server.transfer from a new ASP.NET
    application back to an old ASP application. Server.Transfer will try to make
    your ASP.NET application load the .asp page into it's runtime. That of
    course can't happen since the code is foreign to it.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Brent White" <> wrote in message
    news:...
    > If you need more information, I'd be glad to give it, but I am
    > developing an ASPX page so that the user can select multiple values for
    > a specific field, then pass them on (using Crystal Reports 10 on a
    > separate ASP page). Here is the code behind the button that will
    > launch the report (is in a file called StateSelect.aspx.vb:
    >
    > Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Button2.Click
    > Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    > End Sub
    >
    >
    > When I launch the ASP page and hit the submit button, I get the
    > following error in the IE window:
    >
    > Server Error in '/NEWCrystalReports' Application.
    > --------------------------------------------------------------------------------
    >
    > Error executing child request for /NewCrystalReports/genericreport.asp.
    >
    > Description: An unhandled exception occurred during the execution of
    > the current web request. Please review the stack trace for more
    > information about the error and where it originated in the code.
    >
    > Exception Details: System.Web.HttpException: Error executing child
    > request for /NewCrystalReports/genericreport.asp.
    >
    > Source Error:
    >
    >
    > Line 40:
    > Line 41: Protected Sub Button2_Click(ByVal sender As Object, ByVal
    > e As System.EventArgs) Handles Button2.Click
    > Line 42:
    > Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    > Line 43: End Sub
    > Line 44: End Class
    >
    >
    > Source File: c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb
    > Line: 42
    >
    > Stack Trace:
    >
    >
    > [HttpException (0x80004005): Error executing child request for
    > /NewCrystalReports/genericreport.asp.]
    > System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
    > TextWriter writer, Boolean preserveForm, String path, String filePath,
    > String physPath, Exception error, String queryStringOverride) +3137343
    > System.Web.HttpServerUtility.Execute(String path, TextWriter writer,
    > Boolean preserveForm) +722
    > System.Web.HttpServerUtility.Transfer(String path, Boolean
    > preserveForm) +55
    > _Default.Button2_Click(Object sender, EventArgs e) in
    > c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb:42
    > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    > System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    > eventArgument) +78
    >
    > System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
    > eventArgument) +7
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > sourceControl, String eventArgument) +11
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > +33
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    > +5670
    >
    >
    >
    >
    > --------------------------------------------------------------------------------
    > Version Information: Microsoft .NET Framework Version:2.0.50215.44;
    > ASP.NET Version:2.0.50215.44
    >
    >
    >
    >
    >
    > There is this line in the ASPX file itself:
    >
    > <form method="post" id="form1" runat="server"
    > action="GenericReport.asp">
    >
    >
    >
    >
    >
    > The server is running ASP.NET v2 (Windows 2003 Server with IIS 6) and I
    > am developing in VS .NET 2005.
    >
     
    S. Justin Gengo, Oct 26, 2005
    #2
    1. Advertising

  3. Brent White

    Brent Guest

    How do I post to the existing ASP page from the ASP.NET page then?

    "S. Justin Gengo" wrote:
    >Brent,
    >
    >I'm pretty certain that you can't server.transfer from a new ASP.NET
    >application back to an old ASP application. Server.Transfer will try to

    make
    >your ASP.NET application load the .asp page into it's runtime. That of
    >course can't happen since the code is foreign to it.
    >
    >--
    >Sincerely,
    >
    >S. Justin Gengo, MCP
    >Web Developer / Programmer
    >
    >www.aboutfortunate.com
    >
    >"Out of chaos comes order."
    > Nietzsche
    >"Brent White" <> wrote in message
    >news:...
    >> If you need more information, I'd be glad to give it, but I am
    >> developing an ASPX page so that the user can select multiple values

    for
    >> a specific field, then pass them on (using Crystal Reports 10 on a
    >> separate ASP page). Here is the code behind the button that will
    >> launch the report (is in a file called StateSelect.aspx.vb:
    >>
    >> Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Button2.Click
    >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    >> End Sub
    >>
    >>
    >> When I launch the ASP page and hit the submit button, I get the
    >> following error in the IE window:
    >>
    >> Server Error in '/NEWCrystalReports' Application.
    >>

    ------------------------------------------------------------------------
    --------
    >>
    >> Error executing child request for

    /NewCrystalReports/genericreport.asp.
    >>
    >> Description: An unhandled exception occurred during the execution of
    >> the current web request. Please review the stack trace for more
    >> information about the error and where it originated in the code.
    >>
    >> Exception Details: System.Web.HttpException: Error executing child
    >> request for /NewCrystalReports/genericreport.asp.
    >>
    >> Source Error:
    >>
    >>
    >> Line 40:
    >> Line 41: Protected Sub Button2_Click(ByVal sender As Object,

    ByVal
    >> e As System.EventArgs) Handles Button2.Click
    >> Line 42:
    >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    >> Line 43: End Sub
    >> Line 44: End Class
    >>
    >>
    >> Source File: c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb
    >> Line: 42
    >>
    >> Stack Trace:
    >>
    >>
    >> [HttpException (0x80004005): Error executing child request for
    >> /NewCrystalReports/genericreport.asp.]
    >> System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
    >> TextWriter writer, Boolean preserveForm, String path, String

    filePath,
    >> String physPath, Exception error, String queryStringOverride)

    +3137343
    >> System.Web.HttpServerUtility.Execute(String path, TextWriter

    writer,
    >> Boolean preserveForm) +722
    >> System.Web.HttpServerUtility.Transfer(String path, Boolean
    >> preserveForm) +55
    >> _Default.Button2_Click(Object sender, EventArgs e) in
    >> c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb:42
    >> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    >> System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    >> eventArgument) +78
    >>
    >>

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
    sePostBackEvent(String
    >> eventArgument) +7
    >> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    >> sourceControl, String eventArgument) +11
    >> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    >> +33
    >> System.Web.UI.Page.ProcessRequestMain(Boolean
    >> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >> +5670
    >>
    >>
    >>
    >>
    >>

    ------------------------------------------------------------------------
    --------
    >> Version Information: Microsoft .NET Framework Version:2.0.50215.44;
    >> ASP.NET Version:2.0.50215.44
    >>
    >>
    >>
    >>
    >>
    >> There is this line in the ASPX file itself:
    >>
    >> <form method="post" id="form1" runat="server"
    >> action="GenericReport.asp">
    >>
    >>
    >>
    >>
    >>
    >> The server is running ASP.NET v2 (Windows 2003 Server with IIS 6) and

    I
    >> am developing in VS .NET 2005.
    >>

    >
    >




    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
     
    Brent, Oct 26, 2005
    #3
  4. Response.Redirect

    "Brent" wrote:

    > How do I post to the existing ASP page from the ASP.NET page then?
    >
    > "S. Justin Gengo" wrote:
    > >Brent,
    > >
    > >I'm pretty certain that you can't server.transfer from a new ASP.NET
    > >application back to an old ASP application. Server.Transfer will try to

    > make
    > >your ASP.NET application load the .asp page into it's runtime. That of
    > >course can't happen since the code is foreign to it.
    > >
    > >--
    > >Sincerely,
    > >
    > >S. Justin Gengo, MCP
    > >Web Developer / Programmer
    > >
    > >www.aboutfortunate.com
    > >
    > >"Out of chaos comes order."
    > > Nietzsche
    > >"Brent White" <> wrote in message
    > >news:...
    > >> If you need more information, I'd be glad to give it, but I am
    > >> developing an ASPX page so that the user can select multiple values

    > for
    > >> a specific field, then pass them on (using Crystal Reports 10 on a
    > >> separate ASP page). Here is the code behind the button that will
    > >> launch the report (is in a file called StateSelect.aspx.vb:
    > >>
    > >> Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
    > >> System.EventArgs) Handles Button2.Click
    > >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    > >> End Sub
    > >>
    > >>
    > >> When I launch the ASP page and hit the submit button, I get the
    > >> following error in the IE window:
    > >>
    > >> Server Error in '/NEWCrystalReports' Application.
    > >>

    > ------------------------------------------------------------------------
    > --------
    > >>
    > >> Error executing child request for

    > /NewCrystalReports/genericreport.asp.
    > >>
    > >> Description: An unhandled exception occurred during the execution of
    > >> the current web request. Please review the stack trace for more
    > >> information about the error and where it originated in the code.
    > >>
    > >> Exception Details: System.Web.HttpException: Error executing child
    > >> request for /NewCrystalReports/genericreport.asp.
    > >>
    > >> Source Error:
    > >>
    > >>
    > >> Line 40:
    > >> Line 41: Protected Sub Button2_Click(ByVal sender As Object,

    > ByVal
    > >> e As System.EventArgs) Handles Button2.Click
    > >> Line 42:
    > >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    > >> Line 43: End Sub
    > >> Line 44: End Class
    > >>
    > >>
    > >> Source File: c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb
    > >> Line: 42
    > >>
    > >> Stack Trace:
    > >>
    > >>
    > >> [HttpException (0x80004005): Error executing child request for
    > >> /NewCrystalReports/genericreport.asp.]
    > >> System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
    > >> TextWriter writer, Boolean preserveForm, String path, String

    > filePath,
    > >> String physPath, Exception error, String queryStringOverride)

    > +3137343
    > >> System.Web.HttpServerUtility.Execute(String path, TextWriter

    > writer,
    > >> Boolean preserveForm) +722
    > >> System.Web.HttpServerUtility.Transfer(String path, Boolean
    > >> preserveForm) +55
    > >> _Default.Button2_Click(Object sender, EventArgs e) in
    > >> c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb:42
    > >> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    > >> System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    > >> eventArgument) +78
    > >>
    > >>

    > System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
    > sePostBackEvent(String
    > >> eventArgument) +7
    > >> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    > >> sourceControl, String eventArgument) +11
    > >> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    > >> +33
    > >> System.Web.UI.Page.ProcessRequestMain(Boolean
    > >> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    > >> +5670
    > >>
    > >>
    > >>
    > >>
    > >>

    > ------------------------------------------------------------------------
    > --------
    > >> Version Information: Microsoft .NET Framework Version:2.0.50215.44;
    > >> ASP.NET Version:2.0.50215.44
    > >>
    > >>
    > >>
    > >>
    > >>
    > >> There is this line in the ASPX file itself:
    > >>
    > >> <form method="post" id="form1" runat="server"
    > >> action="GenericReport.asp">
    > >>
    > >>
    > >>
    > >>
    > >>
    > >> The server is running ASP.NET v2 (Windows 2003 Server with IIS 6) and

    > I
    > >> am developing in VS .NET 2005.
    > >>

    > >
    > >

    >
    >
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    >
     
    =?Utf-8?B?U3JlZWppdGggUmFt?=, Oct 26, 2005
    #4
  5. Brent,

    Yes, Sreejith is correct you need to use a Response.Redirect. And then
    include the values you need to pass to the ASP page in the querystring.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Sreejith Ram" <> wrote in message
    news:...
    >
    > Response.Redirect
    >
    > "Brent" wrote:
    >
    >> How do I post to the existing ASP page from the ASP.NET page then?
    >>
    >> "S. Justin Gengo" wrote:
    >> >Brent,
    >> >
    >> >I'm pretty certain that you can't server.transfer from a new ASP.NET
    >> >application back to an old ASP application. Server.Transfer will try to

    >> make
    >> >your ASP.NET application load the .asp page into it's runtime. That of
    >> >course can't happen since the code is foreign to it.
    >> >
    >> >--
    >> >Sincerely,
    >> >
    >> >S. Justin Gengo, MCP
    >> >Web Developer / Programmer
    >> >
    >> >www.aboutfortunate.com
    >> >
    >> >"Out of chaos comes order."
    >> > Nietzsche
    >> >"Brent White" <> wrote in message
    >> >news:...
    >> >> If you need more information, I'd be glad to give it, but I am
    >> >> developing an ASPX page so that the user can select multiple values

    >> for
    >> >> a specific field, then pass them on (using Crystal Reports 10 on a
    >> >> separate ASP page). Here is the code behind the button that will
    >> >> launch the report (is in a file called StateSelect.aspx.vb:
    >> >>
    >> >> Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
    >> >> System.EventArgs) Handles Button2.Click
    >> >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    >> >> End Sub
    >> >>
    >> >>
    >> >> When I launch the ASP page and hit the submit button, I get the
    >> >> following error in the IE window:
    >> >>
    >> >> Server Error in '/NEWCrystalReports' Application.
    >> >>

    >> ------------------------------------------------------------------------
    >> --------
    >> >>
    >> >> Error executing child request for

    >> /NewCrystalReports/genericreport.asp.
    >> >>
    >> >> Description: An unhandled exception occurred during the execution of
    >> >> the current web request. Please review the stack trace for more
    >> >> information about the error and where it originated in the code.
    >> >>
    >> >> Exception Details: System.Web.HttpException: Error executing child
    >> >> request for /NewCrystalReports/genericreport.asp.
    >> >>
    >> >> Source Error:
    >> >>
    >> >>
    >> >> Line 40:
    >> >> Line 41: Protected Sub Button2_Click(ByVal sender As Object,

    >> ByVal
    >> >> e As System.EventArgs) Handles Button2.Click
    >> >> Line 42:
    >> >> Server.Transfer("/NewCrystalReports/genericreport.asp", True)
    >> >> Line 43: End Sub
    >> >> Line 44: End Class
    >> >>
    >> >>
    >> >> Source File: c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb
    >> >> Line: 42
    >> >>
    >> >> Stack Trace:
    >> >>
    >> >>
    >> >> [HttpException (0x80004005): Error executing child request for
    >> >> /NewCrystalReports/genericreport.asp.]
    >> >> System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
    >> >> TextWriter writer, Boolean preserveForm, String path, String

    >> filePath,
    >> >> String physPath, Exception error, String queryStringOverride)

    >> +3137343
    >> >> System.Web.HttpServerUtility.Execute(String path, TextWriter

    >> writer,
    >> >> Boolean preserveForm) +722
    >> >> System.Web.HttpServerUtility.Transfer(String path, Boolean
    >> >> preserveForm) +55
    >> >> _Default.Button2_Click(Object sender, EventArgs e) in
    >> >> c:\inetpub\wwwroot\NEWCrystalReports\StateSelect.aspx.vb:42
    >> >> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    >> >> System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    >> >> eventArgument) +78
    >> >>
    >> >>

    >> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Rai
    >> sePostBackEvent(String
    >> >> eventArgument) +7
    >> >> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    >> >> sourceControl, String eventArgument) +11
    >> >> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    >> >> +33
    >> >> System.Web.UI.Page.ProcessRequestMain(Boolean
    >> >> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >> >> +5670
    >> >>
    >> >>
    >> >>
    >> >>
    >> >>

    >> ------------------------------------------------------------------------
    >> --------
    >> >> Version Information: Microsoft .NET Framework Version:2.0.50215.44;
    >> >> ASP.NET Version:2.0.50215.44
    >> >>
    >> >>
    >> >>
    >> >>
    >> >>
    >> >> There is this line in the ASPX file itself:
    >> >>
    >> >> <form method="post" id="form1" runat="server"
    >> >> action="GenericReport.asp">
    >> >>
    >> >>
    >> >>
    >> >>
    >> >>
    >> >> The server is running ASP.NET v2 (Windows 2003 Server with IIS 6) and

    >> I
    >> >> am developing in VS .NET 2005.
    >> >>
    >> >
    >> >

    >>
    >>
    >>
    >> --
    >> Sent via .NET Newsgroups
    >> http://www.dotnetnewsgroups.com
    >>
     
    S. Justin Gengo, Oct 26, 2005
    #5
  6. Brent White

    Brent Guest

    I don't suppose there's a way to pass the request parameters through
    code instead of appending it to the URL, is there?

    I ask because what I am passing is a filter selection for a Crystal 10
    report that contains the States the report should be viewed for and the
    report name itself (to lessen the number of ASP files I have to maintain
    in the virtual directory), and that URL may be quite long and contain
    some illegal characters.

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
     
    Brent, Oct 26, 2005
    #6
  7. Brent,

    The only other thing I can think of is a bit lengthy, but you could put a
    literal control onto a page and then use the HttpWebRequest object to post
    to the page with the included parameters and then render the results to the
    literal.

    That would look something like this:

    ***Also a word of warning. It took me a while to get this working (sorry it
    took so long to post back) because I kept getting 405 Method not allowed
    errors from the site I was testing this code against. It turned out that the
    server was refusing the posted data because I was using fake parameters. You
    have to post with each and every paramter named exactly as the page is
    expecting and go directly to the page or you'll get that error.

    '---Create the request
    Dim WebRequest As System.Net.WebRequest
    WebRequest = System.Net.WebRequest.Create(New
    Uri(http://www.mysite.com/mypage.asp))

    '---Optionally set the timeout (if you don't the default timeout will be
    used)
    WebRequest.Timeout = 2000

    '---Create the post data
    Dim PostData As String = "id=" & HttpUtility.UrlEncode("1234") & "&state=" &
    HttpUtility.UrlEncode("WI")
    WebRequest.Method = "POST"

    Dim PostBuffer() As Byte =
    System.Text.Encoding.GetEncoding(1252).GetBytes(PostData)

    WebRequest.ContentLength = PostBuffer.Length
    WebRequest.ContentType = "application/x-www-form-urlencoded"

    Dim PostDataStream As System.IO.Stream = WebRequest.GetRequestStream()
    PostDataStream.Write(PostBuffer, 0, PostBuffer.Length)
    PostDataStream.Close()

    '---Get the response produced by the request
    Dim Response As System.Net.WebResponse = WebRequest.GetResponse

    '---Download the page content into a stream
    Dim Stream As System.IO.Stream = Response.GetResponseStream

    '---Place the stream into a stream reader
    Dim StreamReader As New System.IO.StreamReader(Stream)

    '---Read the stream into a string object
    Dim Html As String = StreamReader.ReadToEnd

    '---Cleanup for the next request
    Stream.Close()
    StreamReader.Close()

    '---Place the page found into the literal control
    Literal1.Text = Html

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Brent" <> wrote in message
    news:OQ%...
    >I don't suppose there's a way to pass the request parameters through
    > code instead of appending it to the URL, is there?
    >
    > I ask because what I am passing is a filter selection for a Crystal 10
    > report that contains the States the report should be viewed for and the
    > report name itself (to lessen the number of ASP files I have to maintain
    > in the virtual directory), and that URL may be quite long and contain
    > some illegal characters.
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
     
    S. Justin Gengo, Oct 26, 2005
    #7
  8. Another approach would be to create a table to hold the transaction data for
    the report..

    steps would be like this...

    create a key value from asp.net page
    save params for the report in the transaction table with the key , from
    asp.net page
    redirect to the asp page & pass the key using query string
    read the parameters from asp page
    delete the record in the transaction table for the key, from asp page..

    What Justin suggested may be a better solution than this. if the crystal
    report is being opened in the same window as asp page , would assigning the
    response to literal work ? the Request.ContentType will need to be changed i
    suppose. not sure..

    "S. Justin Gengo" wrote:

    > Brent,
    >
    > The only other thing I can think of is a bit lengthy, but you could put a
    > literal control onto a page and then use the HttpWebRequest object to post
    > to the page with the included parameters and then render the results to the
    > literal.
    >
    > That would look something like this:
    >
    > ***Also a word of warning. It took me a while to get this working (sorry it
    > took so long to post back) because I kept getting 405 Method not allowed
    > errors from the site I was testing this code against. It turned out that the
    > server was refusing the posted data because I was using fake parameters. You
    > have to post with each and every paramter named exactly as the page is
    > expecting and go directly to the page or you'll get that error.
    >
    > '---Create the request
    > Dim WebRequest As System.Net.WebRequest
    > WebRequest = System.Net.WebRequest.Create(New
    > Uri(http://www.mysite.com/mypage.asp))
    >
    > '---Optionally set the timeout (if you don't the default timeout will be
    > used)
    > WebRequest.Timeout = 2000
    >
    > '---Create the post data
    > Dim PostData As String = "id=" & HttpUtility.UrlEncode("1234") & "&state=" &
    > HttpUtility.UrlEncode("WI")
    > WebRequest.Method = "POST"
    >
    > Dim PostBuffer() As Byte =
    > System.Text.Encoding.GetEncoding(1252).GetBytes(PostData)
    >
    > WebRequest.ContentLength = PostBuffer.Length
    > WebRequest.ContentType = "application/x-www-form-urlencoded"
    >
    > Dim PostDataStream As System.IO.Stream = WebRequest.GetRequestStream()
    > PostDataStream.Write(PostBuffer, 0, PostBuffer.Length)
    > PostDataStream.Close()
    >
    > '---Get the response produced by the request
    > Dim Response As System.Net.WebResponse = WebRequest.GetResponse
    >
    > '---Download the page content into a stream
    > Dim Stream As System.IO.Stream = Response.GetResponseStream
    >
    > '---Place the stream into a stream reader
    > Dim StreamReader As New System.IO.StreamReader(Stream)
    >
    > '---Read the stream into a string object
    > Dim Html As String = StreamReader.ReadToEnd
    >
    > '---Cleanup for the next request
    > Stream.Close()
    > StreamReader.Close()
    >
    > '---Place the page found into the literal control
    > Literal1.Text = Html
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    > "Brent" <> wrote in message
    > news:OQ%...
    > >I don't suppose there's a way to pass the request parameters through
    > > code instead of appending it to the URL, is there?
    > >
    > > I ask because what I am passing is a filter selection for a Crystal 10
    > > report that contains the States the report should be viewed for and the
    > > report name itself (to lessen the number of ASP files I have to maintain
    > > in the virtual directory), and that URL may be quite long and contain
    > > some illegal characters.
    > >
    > > --
    > > Sent via .NET Newsgroups
    > > http://www.dotnetnewsgroups.com

    >
    >
    >
     
    =?Utf-8?B?U3JlZWppdGggUmFt?=, Oct 26, 2005
    #8
  9. Sreejith,

    Good point. I was assuming that it's a web report. If it isn't then a
    response.type coud be set to deliver the stream as a file.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "Sreejith Ram" <> wrote in message
    news:...
    > Another approach would be to create a table to hold the transaction data
    > for
    > the report..
    >
    > steps would be like this...
    >
    > create a key value from asp.net page
    > save params for the report in the transaction table with the key , from
    > asp.net page
    > redirect to the asp page & pass the key using query string
    > read the parameters from asp page
    > delete the record in the transaction table for the key, from asp page..
    >
    > What Justin suggested may be a better solution than this. if the crystal
    > report is being opened in the same window as asp page , would assigning
    > the
    > response to literal work ? the Request.ContentType will need to be changed
    > i
    > suppose. not sure..
    >
    > "S. Justin Gengo" wrote:
    >
    >> Brent,
    >>
    >> The only other thing I can think of is a bit lengthy, but you could put a
    >> literal control onto a page and then use the HttpWebRequest object to
    >> post
    >> to the page with the included parameters and then render the results to
    >> the
    >> literal.
    >>
    >> That would look something like this:
    >>
    >> ***Also a word of warning. It took me a while to get this working (sorry
    >> it
    >> took so long to post back) because I kept getting 405 Method not allowed
    >> errors from the site I was testing this code against. It turned out that
    >> the
    >> server was refusing the posted data because I was using fake parameters.
    >> You
    >> have to post with each and every paramter named exactly as the page is
    >> expecting and go directly to the page or you'll get that error.
    >>
    >> '---Create the request
    >> Dim WebRequest As System.Net.WebRequest
    >> WebRequest = System.Net.WebRequest.Create(New
    >> Uri(http://www.mysite.com/mypage.asp))
    >>
    >> '---Optionally set the timeout (if you don't the default timeout will be
    >> used)
    >> WebRequest.Timeout = 2000
    >>
    >> '---Create the post data
    >> Dim PostData As String = "id=" & HttpUtility.UrlEncode("1234") &
    >> "&state=" &
    >> HttpUtility.UrlEncode("WI")
    >> WebRequest.Method = "POST"
    >>
    >> Dim PostBuffer() As Byte =
    >> System.Text.Encoding.GetEncoding(1252).GetBytes(PostData)
    >>
    >> WebRequest.ContentLength = PostBuffer.Length
    >> WebRequest.ContentType = "application/x-www-form-urlencoded"
    >>
    >> Dim PostDataStream As System.IO.Stream = WebRequest.GetRequestStream()
    >> PostDataStream.Write(PostBuffer, 0, PostBuffer.Length)
    >> PostDataStream.Close()
    >>
    >> '---Get the response produced by the request
    >> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
    >>
    >> '---Download the page content into a stream
    >> Dim Stream As System.IO.Stream = Response.GetResponseStream
    >>
    >> '---Place the stream into a stream reader
    >> Dim StreamReader As New System.IO.StreamReader(Stream)
    >>
    >> '---Read the stream into a string object
    >> Dim Html As String = StreamReader.ReadToEnd
    >>
    >> '---Cleanup for the next request
    >> Stream.Close()
    >> StreamReader.Close()
    >>
    >> '---Place the page found into the literal control
    >> Literal1.Text = Html
    >>
    >> --
    >> Sincerely,
    >>
    >> S. Justin Gengo, MCP
    >> Web Developer / Programmer
    >>
    >> www.aboutfortunate.com
    >>
    >> "Out of chaos comes order."
    >> Nietzsche
    >> "Brent" <> wrote in message
    >> news:OQ%...
    >> >I don't suppose there's a way to pass the request parameters through
    >> > code instead of appending it to the URL, is there?
    >> >
    >> > I ask because what I am passing is a filter selection for a Crystal 10
    >> > report that contains the States the report should be viewed for and the
    >> > report name itself (to lessen the number of ASP files I have to
    >> > maintain
    >> > in the virtual directory), and that URL may be quite long and contain
    >> > some illegal characters.
    >> >
    >> > --
    >> > Sent via .NET Newsgroups
    >> > http://www.dotnetnewsgroups.com

    >>
    >>
    >>
     
    S. Justin Gengo, Oct 26, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SJ
    Replies:
    4
    Views:
    886
  2. darrel
    Replies:
    0
    Views:
    354
    darrel
    May 4, 2006
  3. ThaDoctor
    Replies:
    3
    Views:
    387
    Alan Woodland
    Sep 28, 2007
  4. dotrat1989
    Replies:
    0
    Views:
    250
    dotrat1989
    Dec 2, 2008
  5. Stanley

    Still having collection issues

    Stanley, Feb 2, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    170
    Stanley
    Feb 3, 2004
Loading...

Share This Page