Is it possible to call a web service from an inline code block in ASP.NET without adding a web reference? If so, can you provide instructions?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add a web reference in a another C# project (e.g. console application). Then switch to “show all files”. You’ll find a hidden .cs file that contains the actual web service proxy that was created for you. (There’s also a commandline tool that does the same thing, but I forgot the name)
You can copy the generated class to your .aspx into a
<script runat="server">block.Although I don’t know what you would actually need that for 😉 Don’t you have access to the source code of the web app?
Another solution is to create a .NET dll for the web proxy, then load this assembly dynamically using
Assembly.Load(). Invoking methods dynamically is not pretty though.