In the course I'm taking they taught me to use Response.Redirect like this:
Response.Redirect(string.Format("name.aspx?sb="+bts+"&del="+delimiter));
Is there a better way to do so?
Specifically what you are discussing is the means to transfer state between pages. That can be done in an handful of ways:
See How to: Pass Values Between ASP.NET Web Pages.
In addition you can also use the HttpContext.Current.Items collection to pass data if you are performing a Server.Transfer instead of a Response.Redirect.
Also, the code snippet:
Is just performing string concatenation so you don't need to call string.Format.
Should UrlEncode query string parameters
e.g.
Response.Redirect("name.aspx?sb=" + Server.UrlEncode(bts)
+ "&del=" + Server.UrlEncode(delimiter));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With