Using ASP.NET Redirect without string URL?

Posted by David Dietrich on Stack Overflow See other posts from Stack Overflow or by David Dietrich
Published on 2010-04-23T17:27:06Z Indexed on 2010/04/23 17:33 UTC
Read the original article Hit count: 148

Filed under:
|

For instance, what I have right now is the following:

Page.Response.Redirect("Default.aspx", false);

Needing to hardcode the string just seems odd to me. The Default.aspx page is already in my project. So is there a way to do the redirect something like the following:

Page.Response.Redirect(Default.aspx, false);

Where Default.aspx is just the web form. I'd think that this way it would be obvious if there was a problem such as you deleted the web form but didn't update the redirects.

Is this possible? Or is there another way entirely I should be looking at this?

I suppose I could do something with a static property on the class, but I am wondering if there is a built in thing for this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about response.redirect