| |

VerySource

 Forgot password?
 Register
Search
View: 645|Reply: 5

Regarding the issue of UrlRewriter, friends who have used it please advise

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-13 15:30:01
| Show all posts |Read mode
A question about UrlRewriter with multiple parameters

Conversion of a single parameter has been successful
Original address: ViewNews.aspx? NewsID = 1
Converted to: ViewNews, 1.aspx

Now multi-parameters won't work
such as:
Original address NewsList.aspx? NewsTypeA = 1&NewsTypeB = 2
Convert to NewsList, 1,2.aspx
The system prompts "The input string is malformed"

How should it be achieved? My code is as follows:
    <Rules>
      <RewriterRule>
        <LookFor> ~ / NewsList, (\d +) *, (\d +) *. Aspx </ LookFor>
        <SendTo> ~ / NewsList.aspx? NewsTypeA = $ 1 ^ NewsTypeB = $ 1 </ SendTo>
      </ RewriterRule>
    </ Rules>
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-4-11 18:00:01
| Show all posts
> ~ / NewsList.aspx? NewsTypeA = $ 1&NewsTypeB = $ 2
Reply

Use magic Report

1

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-16 11:30:01
| Show all posts
$ 1 represents variable 1
 $ 2 represents variable 2
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-29 14:15:01
| Show all posts
Thank you in advance, but not with&symbol
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-29 21:00:01
| Show all posts
&amp;
For&
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-30 17:15:01
| Show all posts
Alright, thanks! ! !
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list