Can someone explain why people use the @ sign in things like page redirections?
For example;
response.redirect(@"mypage.aspx");
Seems to work exactly the same as;
response.redirect("mypage.aspx");
I would like to know the purpose of the @ sign.
Can someone explain why people use the @ sign in things like page redirections?
For example;
response.redirect(@"mypage.aspx");
Seems to work exactly the same as;
response.redirect("mypage.aspx");
I would like to know the purpose of the @ sign.
The @ before the string indicates the string is a verbatim string:
So if you are redirecting to a page that is not on the current location as the view, you could say response.redirect(@"path\mypage.aspx"). Without the @, you have to say response.redirect("path\\mypage.aspx")
For your code, you do not need it since the page you are redirecting to is on the same location.
Reference: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim