In my ASP.Net website I am permanently redirecting an URL to other location using <httpRedirect>
in web config.
I am reading URL value from table and redirecting to that URL using Response.Redirect( URL );
It is working perfect.
But now when I try to send the parameter to the calling page using:
Response.Redirect("Default.aspx?name=stackoverflow");
<httpRedirect>
in web.config calles the Default2.aspx
because of following code in web.config:
<location path="Default.aspx">
<system.webServer>
<httpRedirect enabled="true" destination="Default2.aspx" httpResponseStatus="Permanent" />
</system.webServer>
</location>
The Problem is Default2.aspx
does not receive any parameters.
Please help.
Note: I cannot use session variable as page contents depends on that parameter.
For instance,
If user opens another page in new tab with Default.aspx?name=MetaStackOverflow
session variable will get replaced and if first page is refreshed then instead of showing Stackoverflow
content it will show MetaStackOverflow
.
Parameter Binding in ASP.NET Web API. When Web API calls a method on a controller, it must set values for the parameters, a process called binding. This article describes how Web API binds parameters, and how you can customize the binding process.
For example, here is a typical Web API controller method: HttpResponseMessage Put(int id, Product item) { ... } The id parameter is a "simple" type, so Web API tries to get the value from the request URI. The item parameter is a complex type, so Web API uses a media-type formatter to read the value from the request body.
You have multiple options for passing multiple parameters to a GET method: FromRouteAttribute, FromQuery and Model Binding. In this article, we are going to learn how to pass multiple parameters to a GET method. This article covers the following points: What are the ways to pass multiple parameters to a GET method? What is Model Binding?
The HTTP query string is specified by the values following the question mark (?). As you can see from the above query string example (just after “?”), we are passing the parameters in key:value pair, meaning that id is a key variable and txtId.Text is a value of that key.
Don't forget the special characters $V$Q and the exactDestination has to be set to True.
<location path="Help">
<system.webServer>
<httpRedirect enabled="true" destination="/Redirect.aspx$V$Q" httpResponseStatus="Permanent" exactDestination="true" />
</system.webServer>
</location>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With