I have a query that I am parsing using an automation runbook. When I extend a column that has a static URL reference, I get the error:
BadArgumentError- Query could not be parsed at 'https'
The extend looks like this:
| extend Body = strcat(#"<p>The following items are expiring <strong>within 30 days</strong></p>", "<p>Plan to remediate as soon as possible.</p>", "<p>If the item is no longer valid, please remove it from ", "Application Insights</p>", "<p>Property: ", Name, "</p>", "<p>Expires In: ", ExpiresIn, " day(s) " "</p>")
The runbook posts to a logic app via a webhook which sends a readable output to users.
We can use triple backtick (```) to qualify strings that contain single and/or double quotes.
P.S.
Also note the following:
Splicing string literals
Two or more string literals are automatically joined to form a new string literal in the query if they have nothing between them, or they're separated only by whitespace and comments.
print Name = "MyName", ExpiresIn = "7"
| extend Body =
strcat
(
"<p>The following items are expiring <strong>within 30 days</strong></p>"
"<p>Plan to remediate as soon as possible.</p>"
"<p>If the item is no longer valid, please remove it from "
```Application Insights</p>```
"<p>Property: "
, Name
, "</p>"
"<p>Expires In: "
,ExpiresIn
," day(s) "
"</p>"
)
Name
ExpiresIn
Body
MyName
7
The following items are expiring within 30 daysPlan to remediate as soon as possible.If the item is no longer valid, please remove it from Application InsightsProperty: MyNameExpires In: 7 day(s)
Fiddle
Related
I want to check some character in all entrance data before API.
I check in middle-ware but it makes API slowly.
I mean this:
1 Client send request => 2 NGINX =>3 Kestrel => 4 middle-ware=> 5 Code
I want to check in steps before code. I use .net core 2.2
thanks
I want to check body of request to remove extra space and check Persian character.
I do this with Lua !and I say to NGINX to call it.
local string_format = string.format
ngx.req.read_body()
local body = ngx.req.get_body_data() or ""
-- Replace 'Ye' and 'Kaf' arabic char with persian
body = ngx.re.gsub(body, "ي", "ی") -- remove id and name
body = ngx.re.gsub(body, "ك", "ک") -- remove id and name
-- Remove useless space
body = ngx.re.gsub(body, " ", " ") -- remove id and name
body = ngx.re.gsub(body, '" ', '"') -- remove id and name
body = ngx.re.gsub(body, ' "', '"') -- remove id and name
ngx.req.set_body_data(body)
in above I check body and replace it with proper data and again set body.
I hope it will be help other.
So I am using the following in the onValueEdit field of an entry form
var widgets = widget.root.descendants;
var to = 'xxxx#yyy.com';
var subject = 'Delivery Date Change For: ' + widgets.ProjectName.value;
var msg = "The Delivery Date for [ " + widgets.UsersPosition.value + " ] on [ " + widgets.ProjectName.value + " ] has been changed;
sendMessage(to, subject, msg);
So when a user changes a Delivery Date (by adjusting a Date Box) a notification email is sent out. I would like to add the actual in the Date Box but when I add " + widgets.DeliveryDate.value + " it says it is unrecognized.
Since the DeliveryDate is a Date Box, do I need something different? widgets.DeliveryDate.???
Thank you for any help.
"value" property is the one you need. Please note that it's JavaScript Date object so in some cases you need to convert it. But code you provided looks good to me.
What do you mean by "unrecognized"? Could you provide error details?
BTW: it's better to use Server Script to generate email message.
I am having the following issue:
I am using an application that allows users to concatenate text to build a URL that passes parameters to an ASP page via GET method, i.e. something like:
http://myhostname/process.asp?param1=value1¶m2=value2
Problem is value1 and value2 can contain the ampersand symbol, which is not interpreted as a text character.
The most popular solution to this issue is to encode the URL, which is not an option for me because I cannot modify the program that builds the URL. I can modify the process.asp page, but not the program that concatenates the text fields and builds the URL.
Things I've tried to search for are:
How to encode a URL using javascript directly in the browser
How to change IIS default behaviour when reading an &
Alternative ways to pass parameters, i.e. something like passing them as a single string of characters separated with pipes
Hope you can give me some guidance.
You can read the entire query string and parse it yourself, like this:
q = Request.QueryString
a = Split(q, "=")
i = 1
For Each s In a
If i mod 2 = 0 Then
If InStr(s, "&") <> InStrRev(s, "&") Then
Response.Write "Value: " & Left(s, InStrRev(s, "&") - 1) & "<br/>"
hidingParam = Right(s, Len(s) - InStrRev(s, "&"))
Response.Write "PAramName: " & hidingParam & "<br/>"
i = i + 1
Else
Response.Write "Value: " & s & "<br/>"
End If
Else
Response.Write "PAramName: " & s & "<br/>"
End If
i = i + 1
Next
Result:
URL: ...?Q=abc&def&P=123 produces
PAramName: Q Value: abc&def PAramName: P Value: 123
Note that this is less than robust. I am only illustrating my idea. I didn't test with no &.
It also doens't handle multiple "=" characters (if that's a possiblity as well).
If there are 2 (or more) ampersands in-between the equals, then only the last one is a parameter separator. So, using your URL above, and assuming that value1 = "abc&def", and value2 = "123", then the URL will look like:
http://myhostname/process.asp?param1=abc&def¶m2=123
Notice there's 2 ampersands in-between the 2 equals. The last one will be your parameter separator, the rest are part of the value. And any ampersands after the last equals are also part of the value.
You'll have to dissect the incoming URL and apply the appropriate logic.
I have a login page that return the userName to a page called User.aspx. The User.aspx shows the information about the user based on a sql select. I fill 12 labels on the page with the result of the select. I want to keep the information of my 12 labels if the user Quits and enter again in the page.
I save my session
Session("UserPage") = (litHello.Text And litAddresse.Text And litAnimalGenre.Text And litCouriel.Text And litNomAnimal.Text And litPays.Text And litPostalCode.Text And litProvince.Text And litRace.Text And litTel.Text And litVille.Text)
Now how I can proceed too fill all my label with my saved session call UserPage??? That is the question !!! The code is VB.NET
Thank's for helping me
Answer on your question:
I would make a class with multiple properties and save that in the session ;)
Eg.
Public class PropertySession
Public Property ID as integer
Public Property Name as String
Public Property Address as String
End Class
Then (the long way)
Dim currentPropertySession as PropertySession
With PropertySession
.ID = litID.Text
.Name = litName.Text
.Address = litAddress.Text
End With
And finally store
Session("Property") = currentPropertySession
or the shorter way (still need to declare PropertySession)
Session("Property") = New PropertySession With { .ID = litID.Text, .Name = litName.Text, .Address = litAddress.Text}
You can even do this - only to be complete, but i wouldn't do this if i were you -
Session("Property") = New Object With { .ID = litID.Text, .Name = litName.Text, .Address = litAddress.Text}
Additional
There are 8 ways to store data of a user to the next page.
Check out which one is good enough for you.
You can continue to do it the way you have it and then when you read out the session split the values into an array and then loop through your array. You will need to use a delimiter to separate the values so you can split them.
Session("UserPage") = (litHello.Text & "|" & litAddresse.Text & "|" & litAnimalGenre.Text & "|" & litCouriel.Text & "|" & litNomAnimal.Text & "|" & litPays.Text & "|" & litPostalCode.Text & "|" & litProvince.Text & "|" & litRace.Text & "|" & litTel.Text & "|" & litVille.Text)
The when you read out the the values:
dim userInfo as string() = Session("UserPage").toString().split("|")
Now set your labels accordingly
label1.text = userInfo(0)
label2.text = userInfo(1)
etc...
The one problem here is you have to be sure all your values in the session have a value and if they don't you fill it with an empty string "" so that your split will populate the correct number of values.
For authentication things you can use out of the box functionality from ASP.Net. It offers an API with standard providers like SQL Membership Provider etc.
By using web.config settings, you can allow users to access only certain portions of your site (like a members area). Then, if you like to query more information than the Membership Provider API allows you to, you can get the authenticated user identity (you natural key) from anywhere like:
Page.User.Identity.Name
With this information, you can query your database.
I have a server side operation manually generating some json response. Within the json is a property that contains a string value.
What is the easiest way to escape the string value contained within this json result?
So this
string result = "{ \"propName\" : '" + (" *** \\\"Hello World!\\\" ***") + "' }";
would turn into
string result = "{ \"propName\" : '" + SomeJsonConverter.EscapeString(" *** \\\"Hello World!\\\" ***") + "' }";
and result in the following json
{ \"propName\" : '*** \"Hello World!\" ***' }
First of all I find the idea to implement serialization manually not good. You should to do this mostla only for studying purpose or of you have other very important reason why you can not use standard .NET classes (for example use have to use .NET 1.0-3.0 and not higher).
Now back to your code. The results which you produce currently are not in JSON format. You should place the property name and property value in double quotas:
{ "propName" : "*** \"Hello World!\" ***" }
How you can read on http://www.json.org/ the double quota in not only character which must be escaped. The backslash character also must be escaped. You cen verify you JSON results on http://www.jsonlint.com/.
If you implement deserialization also manually you should know that there are more characters which can be escaped abbitionally to \" and \\: \/, \b, \f, \n, \r, \t and \u which follows to 4 hexadecimal digits.
How I wrote at the beginning of my answer, it is better to use standard .NET classes like DataContractJsonSerializer or JavaScriptSerializer. If you have to use .NET 2.0 and not higher you can use Json.NET.
You may try something like:
string.replace(/(\\|")/g, "\\$1").replace("\n", "\\n").replace("\r", "\\r");