Tarik
Tarik

Reputation: 81721

Keeping Original URL while being redirected to Error.aspx

There is a question like the one below and Test System says the answer B is correct but it seems as it states that "You must also ensure that the original URL in the browser is not changed", D should be the answer? Could you please enlighten me on it?

enter image description here

Upvotes: 0

Views: 503

Answers (2)

alb
alb

Reputation: 1

Answer could be D if global.asax had a Page_Error event. Page_Error is a page level event

Upvotes: 0

Aristos
Aristos

Reputation: 66641

The answer B say that is use the ResponseRewrite. In the case of an error the ResponseRewrite all ready have pass and the page have use it, so can not use it again for second time. Eg, if you have a page /super/demo.aspx that url rewrites to -> demo.aspx?a=2&b=1 this have done all ready, and the page demo.aspx have been all ready readed (how to say to the program ? now I have change my mine, and the url rewrites is something else, when all ready has make this call ?).

When inside the demo.aspx throw an error, to use again the url rewrite you need to go to the new page, and the url is going to change.

What (D) can do is to use the Page_Error, that what actually do is to capture errors from all pages on your application, and when the error thow this code reads from the error.aspx page the content and send it to the browser as it is - without change the url, with out make redirect.

Upvotes: 1

Related Questions