VB.NET Web Reference redirect to another URL (Webservices of Reporting Services)

I have two reports created in Reporting Services. And I use the webservices of reporting services for create a export in PDF.
My question is: How Do I change the WebReference url for that appoint to different Reporting Services depending if a production or preproduction Reports.

Example of my code now:

Private Sub Reportes
        Dim rs As New fmb_as_326771.ReportingService

        rs.Credentials = New System.Net.NetworkCredential(USUARIO, CLAVE, DOMINIO)
        ' Render arguments
        Dim result As Byte() = Nothing
        Dim reportPath As String = "/FM/FMB/SISPRE"
        Dim format As String = "PDF" '"HTML4.0"
        Dim historyID As String = Nothing
        Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar><HTMLFragment>True</HTMLFragment></DeviceInfo>"
        Dim MyConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("conn_peic.ConnectionString")


        If InStr(MyConnectionString, "TORTI") <> 0 Then
            rs.Url = "http://imcd-fsw-30/ReportServer/ReportService.asmx"    ' The change of URL

        Else
            rs.Url = "http://imcd-fsw-10/ReportServer/ReportService.asmx"    ' The Change of URL
        End If


        ' Prepare report parameter.
        Dim parameters(0) As fmb_as_326771.ParameterValue
        parameters(0) = New fmb_as_326771.ParameterValue
        parameters(0).Name = "Parameter1"
        parameters(0).Value = CStr(viewstate("ProyectoSessionId"))

        Dim credentials As fmb_as_326771.DataSourceCredentials() = Nothing
        Dim showHideToggle As String = Nothing
        Dim encoding As String
        Dim mimeType As String
        Dim warnings As fmb_as_326771.Warning() = Nothing
        Dim reportHistoryParameters As fmb_as_326771.ParameterValue() = Nothing
        Dim streamIDs As String() = Nothing
        Dim sh As New fmb_as_326771.SessionHeader
        rs.SessionHeaderValue = sh

        Try
            result = rs.Render(reportPath, format, historyID, devInfo, parameters, _
            credentials, showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
            sh.SessionId = rs.SessionHeaderValue.SessionId
            Console.WriteLine("SessionID after call to Render: {0}", rs.SessionHeaderValue.SessionId)
            Console.WriteLine("Execution date and time: {0}", rs.SessionHeaderValue.ExecutionDateTime)
            Console.WriteLine("Is new execution: {0}", rs.SessionHeaderValue.IsNewExecution)

        Catch e As SoapException
            Console.WriteLine(e.Detail.OuterXml)
        End Try
        ' Write the contents of the report to an MHTML file.
        Try
            Dim stream As FileStream = File.Create("c:\reporte.pdf", result.Length)
            Console.WriteLine("File created.")
            stream.Write(result, 0, result.Length)
            Console.WriteLine("Result written to the file.")
            stream.Close()

            Response.ContentType = "application/pdf"
            Response.WriteFile("c:\reporte.pdf")
            Response.Flush()
            Response.Close()
            System.IO.File.Delete("c:\reporte.pdf")


        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub


When run this report the web page appears in blank.
LVL 4
pbocanegraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
dim strURL as string
  strURL = ConfigurationSettings.AppSettings("WebServiceURL")
  dim a as new localhost.Service1 --> This will be the web reference in your project
  a.URL = strURL
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pbocanegraAuthor Commented:
My code run with static URL, but when change the URL property, the report not working. I checked  that the reports is in the new direction where the URL property is appointed.
0
pbocanegraAuthor Commented:
I believe that is security issues.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.