The next hyperlink is supposed to give me the users with ids 001 and 002.
http://localhost:9000/users?myIds=001;002
Is there a problem with the semicolon? the controller is showing receiving only 001 but not 002.
Thanks
You can't pass multiple values into a single GET parameter; you have to separate them out using an ampersand (&):
http://localhost:9000/users?id1=001&id2=002
Then you can access the IDs with id1 and id2 respectively.
If you specifically need to pass a string with a semicolon as a GET parameter, you need to use the HTML entity %3B instead:
http://localhost:9000/users?id1=001%3B002
Related
I am trying to use the MessageAttributes parameter in AWS SNS POST request. This is to customize the Sender ID (by AWS.SNS.SMS.SenderID). I am trying for Germany phone number and hence is allowed to customize the Sender ID. Can any one help me with the correct syntax?
Thanks,
Subhajit
You need to send 3 key/value pairs for each attribute:
MessageAttributes.entry.${index}.Name=${attributeName}&
MessageAttributes.entry.${index}.Value.DataType=String&
MessageAttributes.entry.${index}.Value.StringValue=${attributeValue}
${index} is the numerical index of each attribute, starting with 1
On the second line you need to specify the type of the value. Most common cases are String.
The third line is the actual value. You can see more information in the link above, I have only used strings and StringValue.
All the values need to be url-encoded for obvious reasons.
I was able to solve it using the following:
MessageAttributes.entry.N.Name (key)
MessageAttributes.entry.N.Value (value)
I have two regex that I need to join into one as I am using the RegularExpressionAttribute in ASP.NET and it does not allow multiple instances.
How can I join the following two regex into one?
.*?#(?!.*?\.\.)[^#]+$
[\x00-\x7F]
the first one checks that there are not 2 consecutive dots in the domain part of an email and the second regex checks that all characters are ascii
I thought it might have been as easy as joining them together like (.*?#(?!.*?\.\.)[^#]+$)([\x00-\x7F]) but this does not work
Here is link to previous post relating to this problem
EDIT: I am decorating an string property of my viewmodel using reglarexpression attribute and this gets rendered into javascript using unobtrusive therefore it has to validate using javascript. I failed to mention this in my initial post
You can use:
^[\x00-\x7F]+?#(?!.*?\.\.)(?=[\x01-\x7F]+$)[^#]+$
You can just use this regex
^[\x00-\x7F-[#]]*?#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Or, if you want to match at least 1 character before #:
^[\x00-\x7F]+#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Mind that [\x00-\x7F] also includes # symbol. In C# regex, we can subtract this from the range using -[#] inside the character class.
And you do not need the anchors since you are using this in a RegularExpressionAttribute, I believe.
Here is a demo on regexstorm.net, remove the second #, and you will have a match.
in SQL, if i have a table with column A and B and others, and i need to get the values of the other columns through web service that takes a value of attribute of B as an input, however i only know the A value.
how can i get the value of attribute B using the known A in order to invoke the web service?
sending a query to retrieve B is an option but i don't know the name of the table
thanks in advance
<ABSENCE_DELAY_DATA xmlns="http://tempuri.org/">
<B>string</B>
</ABSENCE_DELAY_DATA>
I am trying to use query strings in ASP.NET. I have a requirement of the following format
http://localhost/website/1/?callback=?
Here 1 denotes the ID of the profile. This means some info from id=1 will be fetched through the string
If this would have been website/2/?callback=? , then the id would be 2. My questions is to how do I use this /id/ as a query string so it can be used to fetch the profile ID. This was my first preference to use /id/ format otherwise I could look into fetching using two ?'s
If the id =1, I want to fetch ID=1 particulars from DB on this page. http://localhost/website/1/?callback=?
In your case the ID is in the PATH, not the query string. You can access the path via Request.Path in an ASPX page. From there you would need to do some string parsing to get at the portion of the path where you expect the ID to be.
In your case I would probably use something like int.Parse(Request.Path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries)[1]), but please note that I've made that line pretty dense for brevity's sake. For starters, you should use int.TryParse() instead of int.Parse(). This code assumes that the ID will always be in the same place in the url. For example, it will work for "/website/2/" and "/user/2/", but not for "/website/somethingelse/2/".
UriTemplate might be a good choice for that sort of parsing. Not to mention, probably a bit more clear and explicit about what's happening.
Check out: http://msdn.microsoft.com/en-us/library/system.uritemplate(v=VS.90).aspx
I have a field with product name
abc® product1
If I get the data from the database and databind it to the dropdownlist. It becomes
<option value="2">abc ® product1</option>
I don't want ASP.net to escape the ® to %amp;reg.
What should I do?
i'm using such thing (see below), maybe it will help you
first i'm encoding data (special symbols) in numeric entites, when push data in database
when i receive it from database, i write such thing in View:
<% =Html.TextBox("test", Model.test).ToString().Replace("&#", "&#")%>
point is, that when you writing Model.test, that actually means Html.Encode(Model.test)
in my case i don't want to simly decode it (because it could be XSS for example), but write only correct data to input value
In your database you shouldn't store abc® product1 but abc® product1. Then when this value is rendered on the page you need to HTML encode it which happens automatically if you use <asp:DropDownList.
As the above person mentioned, abc® is a REALLY bad feild name.
Does it HAVE to be that?
You want to HTML encode the string prior to it being shown in the HTML. This will preserve its name