PostBackUrl PreviousPage problem

73 views
Skip to first unread message

dotarj

unread,
Jun 16, 2006, 11:11:40 AM6/16/06
to UrlRewritingNet
Hello,

I'm having the same problem as mentioned here (but that question is
closed without a solution):

http://groups.google.com/group/UrlRewritingNet/browse_frm/thread/c89577b60c28f0f0

---

Say I have 2 files, both use an alias, e.g.:

File: Alias:
Pages/1.aspx abc.aspx
Pages/2.aspx def.aspx

Then this would be my rewrites section in the Web.Config:

<rewrites>
<add virtualUrl="^~/abc.aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Pages/1.aspx"
ignoreCase="false"/>
<add virtualUrl="^~/def.aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Pages/2.aspx"
ignoreCase="false"/>
</rewrites>

My Pages/1.aspx has two form elements:

<asp:textbox runat="server" id="TextBox1"></asp:textbox>
<asp:button runat="server" text="Button" PostBackUrl="~/def.aspx"
/>

In my Pages/2.aspx (which is the Pages/1.aspx PostBackUrl) I try to
access TextBox1 through the PreviousPage property, but PreviousPage
seems to be null and

I get the following error:

'PreviousPage' threw an exception of type 'System.Web.HttpException'

and

{"The file '/abc.aspx' does not exist."}

Have you found a solution to this (btw: I'm fearly new to ASP.NET,
maybe I'm missing someting here)?

Thanks,

Arjen

Thomas Bandt

unread,
Jun 18, 2006, 5:27:26 PM6/18/06
to UrlRewritingNet
Hi Arjen,

i didn't try it by myself, but I guess that this could be a real "bug"
in the software, because we didn't use this feature till now. At least
for me Cross Page Posting wasn't on the agenda.

I'll add an entry on the bugtracker, maybe there will be a solution out
there within the next few weeks, but I can't ensure that.

Regards, Thomas

dotarj

unread,
Jun 20, 2006, 7:02:47 AM6/20/06
to UrlRewritingNet
Hello Thomas,

Thanks for the reply.

I've been trying to figure this out myself today and found a possible
solution:

Shouldn't the filePath parameter in the RewritePath function inside the
OnPagePreInit event be used to revert the filePath back to the path of
the physical file (destinationUrl)?

At this moment (one of) the RewritePath function calls looks like this:

context.RewritePath(virtualUrl, string.Empty, clientQueryString, true);

I replaced the virtualUrl with the physical Url (destinationUrl) and
this seems to work fine. The PreviousPage property now works. I guess
the PreviousPage property uses the filePath, set in the previous page
by RewritePath, to point to the physical file.

Until this point I didn't have any trouble with this solution but I
guess there is a reason you used the virtualUrl for the RewritePath.

My question is: does the replacing of the filePath parameter conflict
in any way with the module.

Thanks,

Arjen

Thomas Bandt

unread,
Jun 22, 2006, 8:13:07 PM6/22/06
to UrlRewritingNet
I would be happy if you could try it by yourself and report the result
... I know this isn't what you wanted to read, but I don't have the
time to check this out at the moment. As I wrote I added it to our
bugtracker, and next time we take a look at the code we will check the
problem as well as your solution.

Regards

dotarj

unread,
Jun 24, 2006, 4:41:45 AM6/24/06
to UrlRewritingNet
I found another possible solution here:

http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx

Sounds good, but i haven't tested it yet.

Reply all
Reply to author
Forward
0 new messages