Conversion of QueryString value to String [Resolved]

Posted by Self-Innovator under ASP.NET on 4/2/2012 | Points: 10 | Views : 3056 | Status : [Member] | Replies : 4
Hi...
I am trying to Convert the querystring values to Character Arry in C#.
here my Code...
if (!IsPostBack)
{
string PreviligeBit=Request.QueryString["ResultantBit"].ToString();
char[] length=new char[PreviligeBit.ToString().ToCharArray().Length];
char[] UserPrevilige = new char[PreviligeBit.ToString().ToCharArray()];
if (Request.QueryString["ResultantBit"].ToString() != null)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<script language='javascript'>alert('"+Request.QueryString["ResultantBit"].ToString()+"')</script>");
}
}
Here i find Exception.
.Error 3 Cannot implicitly convert type 'char[]' to 'int' D:\Sayeed\UserPreviliges\Home.aspx.cs

Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Jmckamal on: 4/2/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,

There is a method available to convert character array from string - ToCharArray. Its working fine. I have tested.. find the attached screenshot.
string PreviligeBit = Request.QueryString["ResultantBit"].ToString();

char[] length = new char[PreviligeBit.ToString().ToCharArray().Length];

char[] UserPrevilige = PreviligeBit.ToCharArray();


Regards,
Kamaludeen.

 Download source file

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/3/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi kamaludeen...
will u pls explain me why the array list is binded with the values 100,101,111 etc...pls tell me...wat is it...

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jmckamal on: 4/3/2012 [Member] Starter | Points: 25

Up
0
Down
Those are all ASCII values of each character. for eg - d's ASCII value is 100. .NET framework supports ASCII , one of the use of this one is character encoding.

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/4/2012 [Member] Bronze | Points: 25

Up
0
Down
ya i got it kamal .....it's an ASCII values why does it appears there.....

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response