Trim command ?
-
How to use trim command in query string. query string is working but it was redirecting only the first word. if we give like hp & co. than it redirecting only hp, so the record was not found in the redirecting page. can u pls help me.
krishna
-
How to use trim command in query string. query string is working but it was redirecting only the first word. if we give like hp & co. than it redirecting only hp, so the record was not found in the redirecting page. can u pls help me.
krishna
krishnavaradharajan wrote:
hp & co.
You have to escape & symbol. Use
Server.URlEncode()
before passing such values. DoServer.URLDecode()
when getting it.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
krishnavaradharajan wrote:
hp & co.
You have to escape & symbol. Use
Server.URlEncode()
before passing such values. DoServer.URLDecode()
when getting it.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
If i use like that them error was showing like... No overload for method 'UrlEncode' takes '0' arguments
krishna
-
If i use like that them error was showing like... No overload for method 'UrlEncode' takes '0' arguments
krishna
I have given like redirecting from.. Server.UrlEncode(); view = Request.QueryString.Get("view"); redircting to.. Server.UrlDecode(); pid = Request.QueryString.Get("pid");
krishna
-
I have given like redirecting from.. Server.UrlEncode(); view = Request.QueryString.Get("view"); redircting to.. Server.UrlDecode(); pid = Request.QueryString.Get("pid");
krishna
string SomeVariable = Server.UrlEncode(YourValueTobeEncoded);
Append this variable with the URL you are redirecting to. When getting value do
string View = Server.UrlDecode(Request.QueryString.Get(YourQryStringVar))
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
string SomeVariable = Server.UrlEncode(YourValueTobeEncoded);
Append this variable with the URL you are redirecting to. When getting value do
string View = Server.UrlDecode(Request.QueryString.Get(YourQryStringVar))
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
we are encripting the data...directly redircting...without using encoding and decoding..
krishna
-
string SomeVariable = Server.UrlEncode(YourValueTobeEncoded);
Append this variable with the URL you are redirecting to. When getting value do
string View = Server.UrlDecode(Request.QueryString.Get(YourQryStringVar))
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
Its no working, we are not using this encoding and decoding, with using this will u give me the solution
krishna
-
string SomeVariable = Server.UrlEncode(YourValueTobeEncoded);
Append this variable with the URL you are redirecting to. When getting value do
string View = Server.UrlDecode(Request.QueryString.Get(YourQryStringVar))
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
without using encoding and decoding...
krishna
-
without using encoding and decoding...
krishna
Give us a clue - post the code you are using to generate the URL.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
-
Give us a clue - post the code you are using to generate the URL.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
Redirecting from.. public partial class search : System.Web.UI.Page { int pageSize = 5; string view = ""; SqlConnection con = new SqlConnection("server=5.53.4;Database=ecn;User ID=aaa;pwd=bbb"); protected void Page_Load(object sender, EventArgs e) { view = Request.QueryString.Get("view"); if (view == null) { view = ""; } //String abc; //abc = Request.QueryString["ID"]; } ===== Redircting to.. public partial class product1 : System.Web.UI.Page { string pid = ""; SqlConnection con = new SqlConnection("server= 5.53.4;Database=ecn;User ID=aaa;pwd=bbb"); protected void Page_Load(object sender, EventArgs e) { //string pid = Server.UrlDecode(Request.QueryString.Get("view")); pid = Request.QueryString.Get("pid"); } protected void getDetails() { con.Open(); SqlCommand cmd = new SqlCommand("select * from onlinegoa1 where companyname ='"+pid+"'",con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds= new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); } } krishna
krishna
-
Redirecting from.. public partial class search : System.Web.UI.Page { int pageSize = 5; string view = ""; SqlConnection con = new SqlConnection("server=5.53.4;Database=ecn;User ID=aaa;pwd=bbb"); protected void Page_Load(object sender, EventArgs e) { view = Request.QueryString.Get("view"); if (view == null) { view = ""; } //String abc; //abc = Request.QueryString["ID"]; } ===== Redircting to.. public partial class product1 : System.Web.UI.Page { string pid = ""; SqlConnection con = new SqlConnection("server= 5.53.4;Database=ecn;User ID=aaa;pwd=bbb"); protected void Page_Load(object sender, EventArgs e) { //string pid = Server.UrlDecode(Request.QueryString.Get("view")); pid = Request.QueryString.Get("pid"); } protected void getDetails() { con.Open(); SqlCommand cmd = new SqlCommand("select * from onlinegoa1 where companyname ='"+pid+"'",con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds= new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); } } krishna
krishna
We need to see the code that generates the URL which contains the '&' which is causing you problems. You have just given code that reads from the
Request
collection."More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
-
we are encripting the data...directly redircting...without using encoding and decoding..
krishna
-
krishnavaradharajan wrote:
hp & co.
You have to escape & symbol. Use
Server.URlEncode()
before passing such values. DoServer.URLDecode()
when getting it.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
N a v a n e e t h wrote:
Do Server.URLDecode() when getting it.
That's done automatically when you are reading values from the Request.QueryString collection, so you should not do that another time in your code.
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
-
How to use trim command in query string. query string is working but it was redirecting only the first word. if we give like hp & co. than it redirecting only hp, so the record was not found in the redirecting page. can u pls help me.
krishna
krishnavaradharajan wrote:
query string is working
No, it's not working. The values that you put in the url is not encoded properly, so the url is invalid. When putting values in a query string, you have to encode them using Server.UrlEncode so that characters that have a special meaning in an url (or are invalid in an url, like spaces) are replaced with the proper encoded values. Example:
string name = "hp & co"; string home = "http://www.hpco.acme"; string url = "SomePage.aspx?cmpName=" + Server.UrlEncode(name) + "&cmpUrl=" + Server.UrlEncode(home);
The contents of the url variable will be: "SomePage.aspx?cmpName=hp+%26+co&cmpUrl=http%3a%2f%2fwww.hpco.acme"--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
-
N a v a n e e t h wrote:
Do Server.URLDecode() when getting it.
That's done automatically when you are reading values from the Request.QueryString collection, so you should not do that another time in your code.
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
Thanks Guffa. I didn't noticed that
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
N a v a n e e t h wrote:
Do Server.URLDecode() when getting it.
That's done automatically when you are reading values from the Request.QueryString collection, so you should not do that another time in your code.
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
Thanx its working....
krishna