URL Rewrite and IIS

Hi everyone, I have read the URL rewriting tutorial and I’ve try to follow it carefully, but I have this problem.

Before doing that, my detail page had syntax like this:
news-details.aspx? ID = 147

With the URL rewrite, I set the new link:
news-details / 147 /

The URL is passed correctly by the button.
In the landing page I don’t see dynamic data, as if the connection to the server no longer receives ID value.
What did I forget to do?

The URL is passed correctly by the button.
In destination page either I don’t see dynamic data,like server connect couldn’t have ID value.
What I’ve forgotten?

Is there also a metatag added to the page html, like:

<meta name="ac:route" content="/news-details/:ID/">

When route was added using Wappler it should automatically been added to the page.

Yes I’ve checked that
I still have the same problem.

screen1

Details page:

details2

What’s wrong?

don’t use .net but buI assume the Wappler process is identical.
You have remembered to define the parameter which is passed in the App query parameters I assume?

Yes, but I don’t see dynamic data, like server connect couldn’t have ID value.
The same page, without URL rewrite, works correctly

It seems so simple to me; I’ve followed the tutorial. Yet I can’t!
(URL rewrite is installed on the server, in fact if I try with a non-dynamic page, it works fine).

This is the “classic” dynamic URL, that works:

Then I make a Route:
dmx2

In the page “eventi2.aspx” I add this on the top:
dmx3

But why don’t works with new URL?

@patrick can you help me?

On IIS I believe the routing is done via the web.config file, it is an xml file that contains the server configuration. The web.config file should be placed in the root of your server application. It is a while back that I’ve used IIS, but I believe you can see in the IIS Manager the routes that are setup, seems that in your case something goes wrong there.

Yes it’s true. But web.config rules are automatically generated when I set it on Wappler.
In web.config now I see the code:

<!-- Wappler routing -->
<rule name="wappler rewrite natura #3mmdpccg4" stopProcessing="true">
  <match url="^/?natura-a-villar-perosa(?:/)?$" ignoreCase="true" />
  <conditions logicalGrouping="MatchAll">
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
  </conditions>
  <action type="Rewrite" url="natura.aspx" appendQueryString="true" />
</rule>
<rule name="wappler rewrite eventi-a-villar-perosa #dul03iuvn" stopProcessing="true">
  <match url="^/?eventi-a-villar-perosa/([^/]+?)/(?:/)?$" ignoreCase="true" />
  <conditions logicalGrouping="MatchAll">
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
  </conditions>
  <action type="Rewrite" url="eventi2.aspx?id={R:1}" appendQueryString="true" />
</rule>
<!-- End Wappler routing -->

That looks correct. Can you also see the routes that are setup in the web.config within the IIS manager?



Did it do some rewrite, is there some content loaded? In your screenshot you show an empty page, does this mean it didn’t return any html at all or do you get some 404 result?

If I take off the loader and see the below error, I get this

Thx, so the rewrite does actually work correctly, it seems to be only that the param is not being read correctly on the client page. I suppose you use the id on a server connect to load the content, what is the expression used to read the id?

It’s the same that I was using on the page without url rewrite
In fact, I realize that it looks for the query.id value, but it is not passed as it did before in the string id = XXX
How can I do that?

dmx0
dmx1
dmx2

JavaScript is case-sensitive, the parameter is ID, so the expression must be query.ID.

I’m sorry but I just don’t understand what I should change

Try changing the parameter in the path to lowercase, you now have :ID, change that to :id. The problem is probably that in one place you use ID and the other id and these don’t match. Best is to keep all parameters lowercase.