Click here to Skip to main content
16,016,168 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
this is my app.config

<appsettings>
<add key="SSRSReports" value="localhost">


What I have tried:

public string valureports = ConfigurationManager.AppSettings["SSRSReports"];

WithoutAddOns.ServerReport.ReportServerUrl = new Uri(@"http://valureports:80/WebServiceURL");

but not work

id like to ask your pls..on how
Posted

1 solution

You haven't actually explained what the problem is - "not work" is useless as a problem description.

At a guess, you were expecting the value of the valuereports variable to be magically inserted into the string passed to the Uri constructor. But C# doesn't work like that.

(Imagine the confusion if it did: if you declared a variable string name = "Bob";, and then tried to display a message of "Please enter your name:", you would actually display: "Please enter your Bob:"!)

Instead, you need to tell the compiler that you want to insert the value of a variable into the string. There are several ways to do that; the simplest is probably to use string interpolation[^]:
C#
WithoutAddOns.ServerReport.ReportServerUrl = new Uri($"http://{valureports}:80/WebServiceURL");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900