1

My API is expecting url parameters with a dot in their name. Examples:

my.param

my.otherparam

Because of the dot, I can't name the c# variables with the name of the parameters, because my.param is not a valid c# variable name.

Is there any way to give custom variable names?

What I want:

    //...?my.param=value1&my.otherparam=value2
    public string Get([Paramname="my.param"]string my_param,[Paramname="my.otherparam"]string my_otherparam)
    {...}

We are trying to work with a big company, therefore we must use their parameter naming.

1 Answer 1

1

You can use Request-object in the call to get the content of the request:

public string Get()
{
  var query = HttpContext.Current.Request.QueryString;

   //Parse the parameter out of the query-variable

}
Sign up to request clarification or add additional context in comments.

1 Comment

System.Web.HttpContext.Current.Request.QueryString["my.param"]; Works perfectly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.