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?
Default.aspx is different from the class
Default, that is generated automatically for you by the IDE. You can easily have multiple .aspx files inheriting from the same Page class.This is why there is no built-in mechanism for this – there is no guarantee of a 1 to 1 relationship between markup pages and code classes.
Probably the best way to manage this is to simply resource the strings that you are using for redirection if you’re doing it in multiple places.