webshop - shopping cart - button logic
Hi guys,
What a magnificent resource! Thanks so much for sharing your experience with NET 2.0 in a way that really is useful!
Hope you can help with my question:
In the WebShop Application on the shopping cart page, I noticed that when I press the "Proceed to checkout" button there is some validation going on to check if the user is logged in.
When a user is not logged in the framework tries to redirect the person to "/WebShop/login.aspx"
I would like to know how or where I can change this target URL?
For example
I structured the codebase as a subdirectory off a main application
ex: /MyApp/WebShop
So I would like to have non-logged-in users login at: /MyApp/WebShop/login.aspx
In order to make the webshop run in a subdirectory I made the necessary changes to the web.config including changing the "Application Directory from "/" to "/MyApp" and changed the root location where required in each file. 99% of the navigation works great!
I expected to see some button property, or code in the shopping cart, checkout, or the web config where I can specify the target URL where I can send a user to login prior to checkout, but no luck.
What's even more interesting is that when I changed the CausesValidation property on the "proceed to checkout button" to False, I still get the same behavior... I set a breakpoint at the page load for Checkout.aspx, but it never gets hit. Here is the code snippet from the btnCheckout_Click event.
Protected Sub btnCheckout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCheckout.Click
Response.Redirect("CheckOut.aspx") <<-- no page_load happens!!
End Sub
On Page 274 you wrote:
"Because the checkout page is only accessible by authenticated users, you're taken to Login.aspx first if you're not logged in."
I'm hoping you can elaborate on this and share with us what is happening behind the scenes and perhaps offer an example on which function to override
Thanks!
David
|