Hi, I'm sure there must be an easy way of doing this, but assuming I've connected to a specific web service, how can I get the connected web service's URL? Obviously I've set the reference when I've built my project and I could get the setting but I just think there must be a way of verifying from the web service itself, where it's being served from. Thanks :)
mail572352
Posts
-
What web service am I conneccted to? -
Web Service ConfusionIt looks like then, that I have to rebuild my apps if I want to move the web service they refer to :(
-
Web Service ConfusionHi, I have a solution which consists of three projects: a web app, a command line app and a dll containing some code to access a web service. The DLL is confusing me because there seems to be two references to my web service: 1. There's an actual "Web Reference" with "URL Behavior" set to "Dynamic". This seems to get used by the web app when it accesses the DLL. 2. There's also an app.config file which contains a "Properties.Settings" value for the web service's URL and this seems to relate to a "Settings.settings" file in the app's project under the "Properties" folder. This setting seems to get used by the command line app when it accesses the DLL. If I want to change the web service's URL, I'd like to be able to just change the app.config if possible. Is that possible? Do I need the web reference as well? I think I do because otherwise I don't have a namespace I can use. How do I have just one reference to the web service in my DLL? :confused: Thanks :)
-
Get Web Service URLHi, I have a web reference in my code that allows me to access a web service. I want to make sure that I'm accessing the right web service by checking the URL that's stored under the web reference. For example if I'm accessing the web service from server X rather than server Y, I can just refer to the URL but can I get hold of this value somehow? Thanks :)
-
GridView: Bind data to template columnHi, I have a gridview control on an ASP.NET page which I want to populate by binding an array of items to it. The items were all strings so it was easy to do, just have columns with bound fields and setting the DataFields to the property names like this: I now need to add a new item and it consists of an object with a few strings as properties. I'd like to do this but I can't of course: ...where the Product is the object and Code is a string member. How can I do it? Do I need a template? If so, how? Thanks :)
-
Impersonate using credentials of currently logged on user.In IIS 6.0 you can always assign the web service you want to give more access rights to, a custom application pool with the account set to "SYSTEM" or even to log on as a user on the server you can set up with just the permissions your web service needs.
-
Get path in DLL rather than from ASP.NETHi, My ASP.NET page calls a method in a separate DLL. In the DLL it opens an XML file but when I run it, it can't find the XML file because it's looking in the wrong place I think. If it was code-behind on an ASP.NET page I'd just use Server.MapPath() to locate the XML file but how can I do it in the DLL method my ASP.NET page calls? Thanks :)
-
XML lookup table [modified]That's great, thanks :)
-
XML lookup table [modified]Hi, I want to store a set of codes in an XML file and read the contents. I want each object to be a item consisting of a name and a code, so that I can put the name in and get the corresponding code out. What's a simple and efficient way of doing this? I can't use my web.config as there may be many codes. Thanks :)
-
Pass string to error pageThanks, I want to avoid an error code though because I want to display the actual exception detail if I get any and I can't guess as to what exceptions or detail I will get. My solution is that I've used a session variable instead because I can create it when an exception occurs and clear it after I've displayed it.
-
Pass string to error pageHi, My code needs to send a string (error text) to an error page. What's the best way of doing it? The string might be quite long so I want to avoid just sending it as a parameter to the page though that's possible if the error string is short enough.
-
How to serialize a C# class [modified]I want to make my class serializable. It only has a few fields and I want to store the settings as XML. At the moment I use an
XmlSerializer
to serialise and deserialize the object but I have all the code in my program'smain()
method. What I want is to create an instance of my object in mymain()
and just call the object's owndeserialize()
method. What's the best way of doing this? Currently:MyObject obj;
XmlSerializer s = new XmlSerializer(typeof(MyObject));
TextReader r = new StreamReader("myobject.xml");
weights = (MyObject)s.Deserialize(r);
r.Close();Prefer:
MyObject obj = new MyObject;
obj.deserialize();I just want to say as well that there are so many examples out there that ignore the idea of object-oriented programming. If an object is serializable then that object should handle its own serialization. The necessary serialization code shouldn't end up in some separate method in the
main()
function. -
Add, Edit, Delete items from GridViewHi, I have a form which contains a gridview which I populate in the Page_Load method from a basic datasource (an ArrayList of objects). I want to be able to add items to the gridview from a button and I also need to be able to delete and ideally edit the new entries. I've read about the GridView and it seems there are no simple ways of adding my items. Is there a way of reading the information from the GridView back into an arraylist, adding the new item to the arraylist and re-binding the gridview to the modified data source? How about the deleting and editing items?
-
dropdownlist being ignoredHi, I have a simple form with a textbox and a drop down list on it. I've used an ASP.NET (2.0) ddl control and an ASP.NET button for submitting the form. I have an event handler on the submit button, btnSubmit_Click() which triggers when the submit button is clicked. When I try and access the ddl's value in the event handler, it's always set to the original value it was when the page was loaded. In other words, it ignores whatever the user changes it too before clicking "Submit". Here's my aspx: <form id="frmTest" runat="server" action="test.aspx" method="post"> <asp:DropDownList ID="ddlColor" runat="server"> <asp:ListItem Value="Red">Red</asp:ListItem> <asp:ListItem Value="Amber">Amber</asp:ListItem> <asp:ListItem Value="Green">Green</asp:ListItem> </asp:DropDownList> <asp:button id="btnSubmit" text="Submit!" onClick="btnSubmit_Click" runat="server" /> Here's the code behind: protected void btnSubmit_Click(object sender, EventArgs e) { String str = ddlColor.SelectedItem.Text; } Do I need to call anything to get the changed value of the DDL before I look at the
ddlColor.SelectedItem.Text
property? -
Grouping ASP.NET controls togetherIs there any way of grouping ASP.NET controls together? I'd like to set a group of controls as invisible rather than having to set each individual control as invisible. Just want to cut down on the amount of code and make it more readable.
-
Web Reference difference between projectsI have a solution with two projects. One is a web site project and the other is a DLL. I want to move a web reference from my web site project to my DLL but the "Add Web Reference" doesn't work with my DLL as it does with the web site. 1. If I add a web reference to my web site, I get a folder underneath App_WebReferences listing the following: MyWebService.disco MyWebService.discomap MyWebService.wsdl I can then reference the web service in my web site's code. 2. If I add the same web reference to my DLL I get a single object under the "Web References" folder. I CAN'T then reference the web service in my DLL's code. The only way around this is to manually create a proxy class using the WSDL tool. What's the difference? Why is it like this?
-
Best way of generating a lookup tableHi, I have to store a list as an external file of part codes and corresponding descriptions for later retrieval by other applications. What's the best way of doing it? Each entry in the list consists of two strings, a part code and a description. I could just write to a text file and read from it again or should I use XML? Anyone have any ideas or examples of how to implement such code? Thanks :)
-
DateTime ToString and ConstructionHi, I have saved a
DateTime
object to a configuration file using theDateTime.ToString()
method. I now want to read the setting and create a newDateTime
object from it. How is this possible? I need both the date and time. I think I could store the day, date, month, year, hours and minutes but this seems overkill and would mean me reading many settings from my configuration file. Surely there is a better solution? Thanks :) -
Application configHi, I have a basic command line application and I want to store a username and password it can use to access a web service. Is there a simple way of doing this using
System.Configuration
? Also I'd like to store my password in an encrypted format. Is there some way of doing this? Thanks :) -
Storing Application SettingsWhat's the best way of storing an application setting to read it later? Do I have to resort to a text file or is there some better way with .NET 2.0?