Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:26+00:00 2026-05-25T06:45:26+00:00

How do I create a dynamic response with out using the query string? I

  • 0

How do I create a dynamic response with out using the query string?

I want to dynamically output the response format based on what the user specifics inside of the message body.

For example, if the user inputs “json”,”xml”,”soap”, it will return the respective format. Thanks, in advance.

public interface IReg
{
    [OperationContract]
    [WebInvoke]
    MemberBasic Login(string uniqueID, string password, string returnFormat);
}

[DataContract(Namespace = "", IsReference=false)]
[Serializable()]
public class MemberBasic
{

    #region Properties
    [DataMember]
    public DateTime LastModified
    {
        get;
        set; 
    }
}
 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public sealed class RWS : IReg
{


    public MemberBasic Login(string uniqueID, string password, string returnFormat)
    {
        MemberBasic result = new MemberBasic();
        setReturnFormat(returnFormat);
        return result;
    }
}
private static void Init(string returnFormat)
    {
        var response = WebOperationContext.Current.OutgoingResponse;
        response.Headers.Add("cache-Control", "no-cache");
        response.Headers.Add("Last-Modified", string.Format("{0:r}", DateTime.Today));

        switch (returnFormat)
        {
            case "xml":
                {
                    WebOperationContext.Current.OutgoingResponse.Format = WebMessageFormat.Xml;
                    WebOperationContext.Current.OutgoingRequest.Headers.Add(System.Net.HttpRequestHeader.ContentType, "application/json");
                } break;
            case "json":
                {
                    WebOperationContext.Current.OutgoingResponse.Format = WebMessageFormat.Json;
                } break;
            default:
                {
                    throw new ArgumentException("Return Format unrecognized; cannot complete request.",
                        "returnFormat");
                }
        }
    }       
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:26+00:00Added an answer on May 25, 2026 at 6:45 am

    The simplest way to do what you are after is to create different endpoints with different bindings. You can have one for POX, SOAP and JSON. They can share contracts and implementations but WCF/configuration is responsible for managing the request/response formats.

    It doesn’t make a lot of sense to have SOAP specified as the response format since, in WCF it would mean the request would also have to be a SOAP request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create dynamic content based on this. I know it's somewhere, as
I'm trying to create a linq query based on some dynamic/optional arguments passed into
Say you create a form using ASP.NET MVC that has a dynamic number of
I am trying to create a new contact using Dynamic Entity. The sample i
i want to create dynamic banner rotater wih php ajax i want to pass
I want to know how to create dynamic table in mySql . I have
I am trying to create a dynamic CSS file using the Django templating engine
I've got a need to create a dynamic proxy in C#. I want this
I should create a query to pass to sqlite3_prepare_v2. The query must be dynamic,
Does python have the ability to create dynamic keywords? For example: qset.filter(min_price__usd__range=(min_price, max_price)) I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.