On Thu, 18 Sep 2008 01:05:04 -0400, "George" <>
wrote:
>There is no redirect involved so nothing messes up the ViewState.
Sorry, by redirect I meant that the original short URL is replaced by
the full URL via form's action, so on the first postback the user goes
to a different URL. The ViewState *can* be affected. I have a form
that erases itself on the first postback, if the short URL is used.
Not sure why this is happening. Just built another, simpler form, and
that one behaves correctly...
>IIS silently replaces the request http://mysite/mydir/ with
>http://mysite/mydir/MyPage.aspx and there is no way for ASP.NET to know that
>the short url was hit.
Ouch! That is really the barrier... Indeed, both Request.Url and
Request.RawUrl contain the actual page name, even if the short URL was
used.
>Then ASP.NET populates the action property of the <form> with currently hit
>page i.e. default.aspx
>
>There is no way to fix it in ASP.NET 1.1 (May be there is but a tricky one
>and i do not know it).
Well, SmartNavigation="true" seem to help (see
window.__smartNav.attachForm in
aspnet_client\system_web\1_1_4322\SmartNav.js), but I would not rely
on that 100%. The same stubborn form mentioned above does not work as
intended.
In theory, if the real URL the user used was discoverable, form's
action could be overridden in Page rendering events somewhere. But it
would be too much hassle, I think. (One "hacky" way to pass the URL
to the server is to grab window.location.href in Javascript and store
it in a server-side hidden control.)
>Starting ASP.NET 3.5 you can specify empty action property of the <form> and
>then ASP.NET will not override it.
>
>
>George.
>
Thanks!