I'm creating an application in Visual Studio which uses web reference. The URL for the reference is:
https://nameSurname.website.com/defectsservice.asmx
Here is how I use it in my code:
DefectsService.Defect defect = new DefectsService.Defect();
defect.Name = mo.DefectName;
defect.DateFound = DateTime.Now;
noDefect = new DefectsService.DefectHandler().AddDefect(mo.Guid, defect);
//DefectsService is the name of the service which I give when I add the reference
I need to make the application like this: the user will enter his URL and his service will be in use. As I can see, the only place where the URL is written in the solution, is in app.config file. But, if I go to 'Show all files', there appear more files with the URL, like configuration.svcinfo, References.cs etc. So, I have a question:
In my solution I have added the service with my name and surname in the URL. If I leave it like that (the service added) and when the user enters his URL, I only change the app.config file, will the code above work like it is for his service, not mine? Or not, because the service already had my URL when I added it?
UPDATE
Here is my code after the suggestion of Wiktor Zychla:
class Program : System.Web.Services.Protocols.SoapHttpClientProtocol
{
public Program()
{
this.Url = "";//url entered from every user
}
static void Main(string[] args)
{
DefectsService.Defect d = new DefectsService.Defect();
defect.Name = mo.DefectName;
defect.DateFound = DateTime.Now;
noDefect = new DefectsService.DefectHandler().AddDefect(mo.Guid, defect);
//DefectsService is the name of the service which I give when I add the reference
}
}