How to return response from the static file in ASP.NET?2019 Community Moderator ElectionHow do you create a dropdownlist from an enum in ASP.NET MVC?How to return XML in ASP.NET?RewritePath for 404 response?Removing Server header from static content in IIS 7/8Can't change IIS response code with URL Rewrite outbound ruleApache rewrite - Virtual dir to php script304 not modified on static filesHow to make endpoint address static while using wcfReturn data in xml or json format in asp.net 5 web api 2 according to request headerweb.config - Ignore rewrite for specific folder
Is there a math expression equivalent to the conditional ternary operator?
How does learning spells work when leveling a multiclass character?
An Undercover Army
Was this cameo in Captain Marvel computer generated?
How can I portion out frozen cookie dough?
Why is there an extra space when I type "ls" on the Desktop?
Tabular environment - text vertically positions itself by bottom of tikz picture in adjacent cell
Rationale to prefer local variables over instance variables?
What does *dead* mean in *What do you mean, dead?*?
What is the purpose of a disclaimer like "this is not legal advice"?
Should we avoid writing fiction about historical events without extensive research?
Why does this boat have a landing pad? (SpaceX's GO Searcher) Any plans for propulsive capsule landings?
Do I need a return ticket to Canada if I'm a Japanese National?
What would be the most expensive material to an intergalactic society?
Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?
How can I have x-axis ticks that show ticks scaled in powers of ten?
ESPP--any reason not to go all in?
Why is my explanation wrong?
Who has more? Ireland or Iceland?
Vector-transposing function
How spaceships determine each other's mass in space?
What does it take to become a wilderness skills guide as a business?
I am the person who abides by rules but breaks the rules . Who am I
Why does a car's steering wheel get lighter with increasing speed
How to return response from the static file in ASP.NET?
2019 Community Moderator ElectionHow do you create a dropdownlist from an enum in ASP.NET MVC?How to return XML in ASP.NET?RewritePath for 404 response?Removing Server header from static content in IIS 7/8Can't change IIS response code with URL Rewrite outbound ruleApache rewrite - Virtual dir to php script304 not modified on static filesHow to make endpoint address static while using wcfReturn data in xml or json format in asp.net 5 web api 2 according to request headerweb.config - Ignore rewrite for specific folder
I am looking for a solution in which I need to make all endpoint (which return XML and Json) to return empty response and a status code.
the XML/JSON response is decided on the accept header in the request. For example someone call my api I can simply return the response from the file.
How to do this in web.config. I am looking for writing a code in rewrite/rule which check the accept header and if this is xml return the empty xml file or if it's json simple return the json file.
I want to make my rule to match the particular url constraint. for example it's all started with testing. this will be something like "^testing" (case insensitive).
so anything match with ^testing and xml return static xml, and with json return static json response.
I also want to set status code in web.config so I can track that my app is maintenance mode.
Any idea how to do this in web.config.
asp.net url-rewriting web-config
add a comment |
I am looking for a solution in which I need to make all endpoint (which return XML and Json) to return empty response and a status code.
the XML/JSON response is decided on the accept header in the request. For example someone call my api I can simply return the response from the file.
How to do this in web.config. I am looking for writing a code in rewrite/rule which check the accept header and if this is xml return the empty xml file or if it's json simple return the json file.
I want to make my rule to match the particular url constraint. for example it's all started with testing. this will be something like "^testing" (case insensitive).
so anything match with ^testing and xml return static xml, and with json return static json response.
I also want to set status code in web.config so I can track that my app is maintenance mode.
Any idea how to do this in web.config.
asp.net url-rewriting web-config
I don't understand. What doesit's telling to fetch the xml or jsonmean?
– VDWWD
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago
add a comment |
I am looking for a solution in which I need to make all endpoint (which return XML and Json) to return empty response and a status code.
the XML/JSON response is decided on the accept header in the request. For example someone call my api I can simply return the response from the file.
How to do this in web.config. I am looking for writing a code in rewrite/rule which check the accept header and if this is xml return the empty xml file or if it's json simple return the json file.
I want to make my rule to match the particular url constraint. for example it's all started with testing. this will be something like "^testing" (case insensitive).
so anything match with ^testing and xml return static xml, and with json return static json response.
I also want to set status code in web.config so I can track that my app is maintenance mode.
Any idea how to do this in web.config.
asp.net url-rewriting web-config
I am looking for a solution in which I need to make all endpoint (which return XML and Json) to return empty response and a status code.
the XML/JSON response is decided on the accept header in the request. For example someone call my api I can simply return the response from the file.
How to do this in web.config. I am looking for writing a code in rewrite/rule which check the accept header and if this is xml return the empty xml file or if it's json simple return the json file.
I want to make my rule to match the particular url constraint. for example it's all started with testing. this will be something like "^testing" (case insensitive).
so anything match with ^testing and xml return static xml, and with json return static json response.
I also want to set status code in web.config so I can track that my app is maintenance mode.
Any idea how to do this in web.config.
asp.net url-rewriting web-config
asp.net url-rewriting web-config
edited 2 days ago
Anirudha Gupta
asked 2 days ago
Anirudha GuptaAnirudha Gupta
5,97253760
5,97253760
I don't understand. What doesit's telling to fetch the xml or jsonmean?
– VDWWD
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago
add a comment |
I don't understand. What doesit's telling to fetch the xml or jsonmean?
– VDWWD
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago
I don't understand. What does
it's telling to fetch the xml or json mean?– VDWWD
2 days ago
I don't understand. What does
it's telling to fetch the xml or json mean?– VDWWD
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
You can write an HttpModule that will somehow check that your website is in maintenance mode. in this case, the module will write a required HTML/Json content directly into HttpResponse and end the Response.
Alternatively, configure IIS to achieve this result.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023407%2fhow-to-return-response-from-the-static-file-in-asp-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can write an HttpModule that will somehow check that your website is in maintenance mode. in this case, the module will write a required HTML/Json content directly into HttpResponse and end the Response.
Alternatively, configure IIS to achieve this result.
add a comment |
You can write an HttpModule that will somehow check that your website is in maintenance mode. in this case, the module will write a required HTML/Json content directly into HttpResponse and end the Response.
Alternatively, configure IIS to achieve this result.
add a comment |
You can write an HttpModule that will somehow check that your website is in maintenance mode. in this case, the module will write a required HTML/Json content directly into HttpResponse and end the Response.
Alternatively, configure IIS to achieve this result.
You can write an HttpModule that will somehow check that your website is in maintenance mode. in this case, the module will write a required HTML/Json content directly into HttpResponse and end the Response.
Alternatively, configure IIS to achieve this result.
answered 2 days ago
VladimirVladimir
71348
71348
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023407%2fhow-to-return-response-from-the-static-file-in-asp-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't understand. What does
it's telling to fetch the xml or jsonmean?– VDWWD
2 days ago
@VDWWD I rewrite the whole text, please check
– Anirudha Gupta
2 days ago