Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have written below lines in `web.config` for url rewriting.

1) rewrite url="^/Results/(.+)/(.+)/Images" to="~/Directory.aspx?l=$1&t=$2&i=1" processing="stop" />

2) rewrite url="^/Results/(.+)/(.+)$" to="~/Directory.aspx?l=$1&t=$2" processing="stop" />

3) rewrite url="~/Results/(.+)/Images" to="~/Directory.aspx?l=$1&i=1" processing="stop" />

Inside `Directory.aspx.cs`:

string Location = string.IsNullOrEmpty(Request.QueryString["l"]) ? "" : Request.QueryString["l"];

string TextPhrase= string.IsNullOrEmpty(Request.QueryString["t"]) ? "" : Request.QueryString["t"];

bool WithImages = string.IsNullOrEmpty(Request.QueryString["i"]) ? false : true;

Now: when I send requests to `Directory.aspx` page, by providing appropriate query strings.
point 1 and 2 are working fine but when I send request with query strings to full fill condition in point 3, it does not seem to be working and `Dictionary.aspx.cs` processes the query strings like,

http://werbsiteaddress.com/Results/US/Images

Location = string.IsNullOrEmpty(Request.QueryString["l"]) ? "" : Request.QueryString["l"]; // US

TextPhrase= string.IsNullOrEmpty(Request.QueryString["t"]) ? "" : Request.QueryString["t"]; // Images

bool WithImages = string.IsNullOrEmpty(Request.QueryString["i"]) ? false : true; // false

Please help me out and let me know if I am missing something.

Thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900