1 / 10

CSCI 6962: Server-side Design and Programming

CSCI 6962: Server-side Design and Programming. Page Redirection. Redirecting to Other Pages. PostBackUrl property Used to set the page that ASP will load upon request Can then access request data from previous page. Setting Start Page. Can set default start page

leoma
Download Presentation

CSCI 6962: Server-side Design and Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 6962: Server-side Design and Programming Page Redirection

  2. Redirecting to Other Pages • PostBackUrlproperty • Used to set the page that ASP will load upon request • Can then access request data from previous page

  3. Setting Start Page • Can set default start page • Right-click page and select “Set as Start Page”

  4. Cross-Page Posting • PostBackUrl is property of each dynamic component • If component activated, transfer to this page instead of posting back to previous page

  5. Retrieving Request Data • PreviousPage object contains reference to form on previous page • Can use PreviousPageIsNot Nothing to make sure it exists • PreviousPage.FindControl(“id”) • Returns reference to previous page element with that id • Usually have to cast to actual type with CType(element, type) • Note: behavior can be flaky, particularly if components inside other containers or forms

  6. Retrieving Request Data • Usually done in Page_Load method in response page • Called when page first loaded Get controls from previous page Extract data from those controls CInt converts string to integer

  7. Other Redirection Methods • Server.Transfer(“URL”) • Server-side redirection • Response.Redirect(“URL”) • Client-side redirection (extra round trip to server) • Invoked programically within event handling code • Do not (easily) pass information from previous form • Often used with sessions

  8. Passing Data Using the URL • Can manually add data to the URL string itself in form URL?name=value&name=value...

  9. Passing Data Using the URL • Can extract the parameters usingRequest.QueryString(“name”)

  10. Unhandled Errors • As with JSP, can specify default pages for unhandled errors • Done in web.configfile • Inside CustomErrorstag • Specify page to go to for unhandled problems with defaultRedirect • Can specify pages for specific types of problems with errorsubtag, specifying statusCode • 404 = Missing page • 500 = Unhandled exception

More Related