.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Read web method input parameter in UTF-8 encoding

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :.NET Framework


I have a web service written in ASP.NET 2.0 using Visual Studio 2005. The web service contains a web method which takes in a string parameter:


[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
    public Service()

        //Uncomment the following line if using designed components 

    public string DoProcess(string input)
        // Do some processing...
        // ....           
        return result;


The web.config file contains the <globalization> tag.


This web method will be called by a third-party client, which will be sending data in UTF-8 encoding. But during development, I created my own test client to test the web method. The client passes in the Unicode characters in UTF-8 as input to the web service method.

I discovered that if the HTTP headers in

View Complete Post

More Related Resource Links

Input Parameter in Finder Method BDC Model

Hi Guys, I know it is possible to create a Finder method with an input parameter, but I am trying to figure out how to pass the parameter to the method. Here's my isssue:   I have created a BDC Model in VS2010, my finder needs to have an input parameter. This input parameter is available on a list that is already available on my site. What are my options to pass this parameter to my finder method and display the results?   My intention (not sure if it makes sense) is to create and action for the model of the list that is already available, so I can capture the variable and pass it in a query string to  a list that I create for the Finder method that requires an input parameter. The problem is I dont know how to do this or even if it the best way to go about solving the problem. Using a business data list and business data related list while possible is really not an option.   Thanks  

SOAP as input parameter in a web service method


I have a webservice method which needs to accept SOAP as input parameter. I've worked webservices between .NET clients but I've never worked using raw SOAP so I don't know what to do. The format of the input like this:

<?xml version="1.0" encoding="utf-8"?>
<S:Envelope xmlns:S = "http://schemas.xmlsoap.org/soap/envelope/">
    <ns2:RemoteService xmlns:ns2 = "some.ns.url">
        <param2>Asd Qwe</param2>
        <param3 xsi:nil = "true" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"/>
    </ns2:RemoteService >

How should my method input be to accept this SOAP as parameter?

I'm using ASP.NET web services not WCF.

SP Datetime parameter requires time input

I'm working on a Crystal report that contains 4 subreports.  Each subreport passes 2 date parameters to a stored procedure.  This works, but only if a value for time is also entered in the Crystal parameter prompt. How can I fix the stored procedure so these parameters will accept only a date as input?

Storing and displaying user input (encoding query)

Hello,I've just been reading up a little on security regarding user input and how to handle html and scripts.My question is, what if I build my own CMS?Isn't it inevitable that I'll want to store html code, possibly scripts, and almost certainly apostrophes and special characters, and then display them again.What's the best way to do this, since I wont want to display the encoded html, but the html itself.Would it be to encode everything then when I want to actually display the html, decode it, but everywhere else, keep it encoded?I'm just trying to think of all the scenario's that I could come across when I accept user input where I don't know what they could be typing in.What if I WANT the user to be able to display html?Is it possible to decode only some tags but leave all other tags encoded? 

Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not

Hi,I am looking for a Method/Way to know whether a input path of FilesSystem contains any Child file/folder or not. To know it currently I am using "Directory.GetFileSystemEntries(Path).Count" and checking if count > 0 then returning True else False. For this first method calculates all the files and folder and then return status to me but I want to exit out as soon as my method gets first element(file/folder) in specified path. Because above method is timing out when my input path contains more than 1 million files. I just need to check whether input folder path contains any child file/folder or not. I have tried to use Win32 API also but on ther server it is crashing so I donot want to use that solution. In .NET any method or way is present to know it. Please suggest me.

Calling a method with a class object as parameter data type.

   [WebMethod]    public string GetInfo(Customer inCust)    {        // Code in here    } I have a web service that resides on a remote server. I want to call a public method of theweb service named  "GetInfo". The method is shown above. The web service method expects a class object oftype "Customer". What I did to create a Customer object was to define in my asp.net project my own class named "Customer" which is exactlythe same as the class that belongs to the web service project on the remote server. I then created an instance of Customerand tried to call the web service passing in an object of type customer : my.Service ws = new my.Service(); // Get web service connectionCustomer aCustomer = new Customer();aCustomer.Initialize();ws.GetInfo(aCustomer) // call web service passing in a Customer object The problem is that the compiler gives me the following error: Value of type '_Default.Customer' cannot be converted to 'ws.Class1'. Here Default is refering to my Default.aspx.cs code. Why is this? Do I need to Cast my "aCustomer" class object to a type ofws.Customer ? How do I do that?

How to get input parameter's count and type by using MetadataImporter

I want to get each input parameter type of all operations in WCF Service via MetadataImporter, the code as below: Service Contract: it is default after you created a wcf applicaiton in vs 2010     [ServiceContract]     public interface IService1     {         [OperationContract]         string GetData(int value);         [OperationContract]         CompositeType GetDataUsingDataContract(CompositeType composite);         // TODO: Add your service operations here     }   Client Side:             string mexAddress = http://localhost:53720/Service1.svc?wsdl;                      BasicHttpBinding binding = new BasicHttpBinding();             MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);             MetadataSet metadata = MEXClient.GetMetadata(new Uri(mexAddress),  MetadataExchangeClientMode.HttpGet);          &nb

Why request parameter added to client side code in each method while using svcutil.exe

Hi, I am using WCF services in my project and want to call WCF methods asynchronously. I am hosting WCF service programmatically in windows app as follows svc = New ServiceHost(GetType(Service1), New Uri("net.tcp://localhost:8806/")) Dim svcMDB As New ServiceMetadataBehavior svc.Description.Behaviors.Add(svcMDB) svc.AddServiceEndpoint(GetType(Service1), New NetTcpBinding(), "MyBusiness/MyBusinessService/") svc.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "MyBusiness/MyBusinessService/mex") svc.Open() Me.Text = "Service started...." and I am generating client side proxy using svcutil.exe as follows. svcutil /n:net.tcp://localhost:8806/MyBusiness/MyBusinessService,MyService net.tcp://localhost:8806/MyBusiness/MyBusinessService/mex /a /language:vb   The result of this command is as :   Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved.   Attempting to download metadata from 'net.tcp://localhost:8806/MyBusiness/MyBusi nessService/mex' using WS-Metadata Exchange. This URL does not support DISCO. Generating files... D:\Prabodh\New C2k\Test Projects\DataTableToArray\MyHost\bin\Debug\MyBusinessSer vice.vb D:

Parameter names ending with "specified" added to web service method call

Hello,I am new to WCF. I created a wcf web service and the generated web method exposed by wcf has some additional boolean parameters with names that end with "Specified".I am trying to understand why are these additional parameters necessary and how to get rid of them. Thanks!David

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

Exposing data contract without passing as input or output parameter for any operation contract


I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?





input parameter in ssrs



Does ssrs allows input parameter from text box? I don't want to chose it from combo box, I'll rather want to type a value. I need to type first 4 characters, and get all values. Something like this:


SELECT DISTINCT articleNo FROM tbl_articles

WHERE articleNo LIKE @InputArticleNo+'%'

ORDER BY articleNo


References parameter in $create() method



Could someone please explain what exactly the references parameter of the $create() method does? my understading from reading the docs is you can pass in a reference to an already created (javascript ?)object that can then be referenced by the object being created. Is this correct? If so, how do I reference the objects passed in using this parameter in the class in question.

This page http://www.asp.net/ajax/documentation/live/clientreference/Sys/ComponentClass/ComponentCreateMethod.aspx mentions it, but does not expand on usage

Cheers Si

Exposing data contract without passing as input or output parameter for any operation contract


I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?

pass a dynamic parameter in a WCF method on HTTP GET


i have a WCF method with 2 known parameters and another one thats supposed to include a Key:Value pairs (dynamic parameter that will include an unknown number of key:value pairs).

the first question is :

i don't want to use XML as the dynamic parameter. what is the common way to pass the dynamic parameter in a WCF method? Dictionary<string,String>? json string? array of complex types? or other? ( my client - the one that uses my service, doesn't have Framework 3.5, so i suggested a framework 2.0 ways to send the parameter)

the second question :

the method  supports HTTP GET , should a dynamic parameter be passed in the URL itself or in the Header? i prefer the URL itself....


thank guys, please help ....

The report parameter 'param1' is read-only and cannot be modified. (rsReadOnlyReportParameter)


hey guys..


I'm trying to get the report that I need to be filtered by a parameter value (named Param1)


I created a parameter in the data tab and tried to pass a value from my Web application to the report services.. now my report have that textbox that prompts me to enter the filtering value for the report I want.. everything works fine till this point..


now I have another webpage that has a report viewer and a textbox for the user input the value they want.. and pass it to the report.. and I'm using the following code to pass the value to the report I made earlier..


Dim par(0) As Microsoft.Reporting.WebForms.ReportParameter

par(0) = New Microsoft.Reporting.WebForms.ReportParameter("paramSiteCode", TextBox1.Text.ToString)




however.. now I'm getting an error.. "The report parameter 'paramSiteCode' is read-only and cannot be modified. (rsReadOnlyReportParameter)"


what am I missing here? I'

How to read all function/method names from .cs file


 Hi everyone,

Normally i answer to the peoples questions here but today i am posting a question for a answer :)

I have a .cs file and i want to read all function/method names from it.

This .cs file is not part of my project or solution other wise i would have used reflection or codedom to do so.

The .cs file is a file on a disk to which i can accessing by giving its physical path say "C:\Sample.cs"

Is there any possibility that i can fetch all the function names declared in Sample.cs

Note: I am doing this for one of my requirement to find out dependencies in code

For example If class A is using some function from class B then class A is dependent on class B. this i need to find out and both this class files are simply a files residing on disk not even part of my project. 

User will select a directory first then any one of the .cs file in that directory and will click on button to find dependencies of that .cs file.

The application should traverse all other .cs files in that directory and find out on how many other .cs files the selected file is dependent.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend