RTSP Stream not receiving data (C# and Sockets) - c#

---------------REQUEST-------------------
DESCRIBE rtsp://192.168.1.201:554 RTSP/1.0
CSeq: 1
User-Agent: Dummy
Accept: application/sdp
----------------------------------
-----------------RESPONSE-----------------
RTSP/1.0 200 OK
CSeq: 1
Date: Wed, Mar 22 2000 05:32:28 GMT
Server: RTSP Server (v1.2.3)
Content-Base: rtsp://192.168.1.201:554/
Content-Type: application/sdp
Content-Length: 440
v=0
o=H.264 0 0 IN IP4 192.168.1.201
s=RTSP Server (v1.2.3)
c=IN IP4 0.0.0.0
i=SP5562HSM
t=0 0
a=range:npt=now-
a=control:*
a=etag:1234567890
m=video 0 RTP/AVP 96
b=AS:1500
a=rtpmap:96 H264/90000
a=control:trackID=0
a=fmtp:96 packetization-mode=0;profile-level-id=42001E;sprop-parameter-sets=Z0IA
HukCg/I=,aM44gA==
a=x-dimensions:320,240
a=sendonly
m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=control:trackID=1
a=sendonly
----------------------------------
---------------REQUEST-------------------
SETUP rtsp://192.168.1.201:554/trackID=0 RTSP/1.0
CSeq: 2
Transport: RTP/AVP;unicast;client_port=58830-58831
User-Agent: Dummy
----------------------------------
-------------RESPONSE---------------------
RTSP/1.0 200 OK
CSeq: 2
Date: Wed, Mar 22 2000 05:32:29 GMT
Server: RTSP Server (v1.2.3)
Session: 2154251319;timeout=80
Transport: RTP/AVP;unicast;client_port=58830-58831;server_port=6004-6005
----------------------------------
SESSION: 2154251319;
SERVER PORT (inp): 6004
---------------REQUEST-------------------
SETUP rtsp://192.168.1.201:554/trackID=1 RTSP/1.0
CSeq: 3
Session: 2154251319;
Transport: RTP/AVP;unicast;client_port=58835-58836
User-Agent: Dummy
----------------------------------
----------------RESPONSE------------------
RTSP/1.0 200 OK
CSeq: 3
Date: Wed, Mar 22 2000 05:32:32 GMT
Server: RTSP Server (v1.2.3)
Session: 2154251318;timeout=80
Transport: RTP/AVP;unicast;client_port=58835-58836;server_port=6002-6003
----------------------------------
---------------REQUEST-------------------
PLAY rtsp://192.168.1.201:554/ RTSP/1.0
CSeq: 4
----------------------------------
----------------RESPONMSE------------------
RTSP/1.0 200 OK
CSeq: 4
Date: Wed, Mar 22 2000 05:32:33 GMT
Server: RTSP Server (v1.2.3)
Session: 2154251318;timeout=80
Range: npt=now-
----------------------------------
This is a log of my requests and responses. I have a separate thread listening on port 58830 accepting udp packets (Tested sending udp from another computer and were received).
Wireshark shows the requests and response but no udp packets. I looked at the back and forth between server and vlc and my request are almost identical but I still receive no udp video data

Your SDP File's IN ADDR seems invalid 0.0.0.0...
Some stacks use the information in the SDP and this could explain why you are not receiving any packets on the address your are listening on.
Also it looks like you are doing multicast, have you ensured you setup the socket correctly before hand?

Related

how can .NET, on Azure VWindows Server 2012, decrypt SMS text message from an AT&T gophone

I wrote a cool .NET Windows application that communicates by SMS text messages with users, or by email. It treats SMS text messages just like email. When my Windows server 2012 receives a text message from a mobile device, or an email, both kinds arrives into C:\inetpub\mailroot\Drop\ and my app processes them.
It all has been working great with email from Gmail, Hotmail, etc., and from SMS from Verizon. But then my friend comes over and we test receiving from his AT&T gophone... Blooey! I get the email (see below) from his mobile device's SMS and all looks normal, except the actual text message payload is scrambled.
How do I descramble? Why is the text scrambled, in the first place?
X-SENDER: ###########MMS.ATT.NET
X-RECEIVER: xxxxxxxxxx#xxxxxxx.COM
RECEIVED: FROM BTHCEG-MOMTA01-MMS.MYCINGULAR.NET ([]) BY WITH MICROSOFT SMTPSVC(8.5.9600.16384);
MON, 5 JUN 2017 17:42:02 -0700
RETURN-PATH: <############MMS.ATT.NET>
RECEIVED: FROM [] ([:14264] HELO=ALPNMS03)
BY BTHCEG-MOMTA01 (ENVELOPE-FROM <############MMS.ATT.NET>)
(ECELERITY 3.0.23.37692 R(37717)) WITH ESMTP
ID D2/65-04620-B5AF5395; MON, 05 JUN 2017 17:42:03 -0700
X-MMS-MESSAGE-TYPE: M-SEND-REQ
X-MMS-TRANSACTION-ID: 1496709721-5
X-MMS-MMS-VERSION: 1.2
TO: PRAY############COM
FROM: ############MMS.ATT.NET
DATE: MON, 5 JUN 2017 20:42:02 -0400 (EDT)
X-MMS-SENDER-VISIBILITY: SHOW
CONTENT-TYPE: MULTIPART/MIXED;
BOUNDARY="----=_PART_7984369_300459990.1496709722943"
MIME-VERSION: 1.0
MESSAGE-ID: <1096997833.194273661496709722943.JAVAMAIL.NEMS#ALPNMS03>
X-ORIGINALARRIVALTIME: 06 JUN 2017 00:42:02.0454 (UTC) FILETIME=[B6A1AF60:01D2DE5D]
------=_PART_7984369_300459990.1496709722943
CONTENT-TYPE: TEXT/PLAIN; CHARSET=UTF-8
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEXT_0.TXT; CHARSET=US-ASCII
CONTENT-ID: 0
CONTENT-LOCATION: TEXT_0.TXT
CONTENT-TRANSFER-ENCODING: BASE64
..................BELOW IS THE SCRAMBLED TEXT MESSAGE: ............
TXKGCHJHEWVYIGLZOIBMB3IGSGVPZGKGDG8GAGF2ZSBWZWFJZSBPBIBOZXIGZMFTAWX5
......THE ACTUAL MESSAGE WAS: "My prayer is: for Heidi to have peace in her family"
------=_PART_7984369_300459990.1496709722943--
X-SENDER: ############MMS.ATT.NET
X-RECEIVER: PRAY############.ORG
RECEIVED: FROM BTHCEG-MOMTA02-MMS.MYCINGULAR.NET ([###########]) BY PRAYSHEP WITH MICROSOFT SMTPSVC(8.5.9600.16384);
MON, 5 JUN 2017 18:14:30 -0700
RETURN-PATH: <############MMS.ATT.NET>
RECEIVED: FROM [###########] ([###########:51516] HELO=ALPNMS03)
BY BTHCEG-MOMTA02 (ENVELOPE-FROM <############MMS.ATT.NET>)
(ECELERITY 3.0.23.37692 R(37717)) WITH ESMTP
ID 29/CD-12903-7F106395; MON, 05 JUN 2017 18:14:31 -0700
X-MMS-MESSAGE-TYPE: M-SEND-REQ
X-MMS-TRANSACTION-ID: 1496711669-7
X-MMS-MMS-VERSION: 1.2
TO: PRAY############.ORG
FROM: ############MMS.ATT.NET
DATE: MON, 5 JUN 2017 21:14:30 -0400 (EDT)
X-MMS-SENDER-VISIBILITY: SHOW
CONTENT-TYPE: MULTIPART/MIXED;
BOUNDARY="----=_PART_7989525_395020720.1496711670941"
MIME-VERSION: 1.0
MESSAGE-ID: <1241288163.194397521496711670942.JAVAMAIL.NEMS#ALPNMS03>
X-ORIGINALARRIVALTIME: 06 JUN 2017 01:14:30.0518 (UTC) FILETIME=[3FC4A960:01D2DE62]
------=_PART_7989525_395020720.1496711670941
CONTENT-TYPE: TEXT/PLAIN; CHARSET=UTF-8
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEXT_0.TXT; CHARSET=US-ASCII
CONTENT-ID: 0
CONTENT-LOCATION: TEXT_0.TXT
CONTENT-TRANSFER-ENCODING: BASE64
................. SCRAMBLED FROM TEXT MESSAGE SMS: ...........
QWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFHYWFH
............ACTUAL WAS ALL "AAAAAAAAAAAAA..."
------=_PART_7989525_395020720.1496711670941--
So this HttpRequest is a Multi-part form.
Each file is split between the boundary:
BOUNDARY="----=_PART_7984369_300459990.1496709722943"
And then each file has its own set of information:
------=_PART_7984369_300459990.1496709722943
CONTENT-TYPE: TEXT/PLAIN; CHARSET=UTF-8
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=TEXT_0.TXT; CHARSET=US-ASCII
CONTENT-ID: 0
CONTENT-LOCATION: TEXT_0.TXT
CONTENT-TRANSFER-ENCODING: BASE64
This boundary has the CONTENT-TRANSFER-ENCODING Header, meaning that all of its contents (TEXT_0.TXT) is encoded as BASE64.
I took a look at what you posted the message was and it should be case sensitive resulting in TXkgcHJheWVyIGlzOiBmb3IgSGVpZGkgdG8gaGF2ZSBwZWFjZSBpbiBoZXIgZmFtaWx5, so you may have some data corruption, or the way you are viewing the encoding is changing it.
I can't provide a code sample as I'm not sure if you are using Webforms or MVC, but here is an example with asp.net MVC Web Api 2

OneNote API - Cannot get Pages

I have been playing around with the OneNote API, and have been successful at getting Notebooks,Sections,Pages.
Today however I have been unsuccessful getting the pages using the Section.pagesUrl.
My Request: https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!19161/pages
Where 0-2B36C9469D6FE2E!19161 is the ID of the section.
This has worked before, but has somehow stopped working.
Right before this request I successfully get the Notebooks, then once finding correct notebook from the returned list, get the sections and again find the correct section.
The response I am getting is 200(OK) but an empty array:
{
"#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/sections('0-2B36C9469D6FE2E%2119161')/pages",
"value":[
]
}
Although I can see the same Notbooks and Sections in my OneNote client. And sections do have pages. But I am not getting them any more.
Any reason why this could be happening?
Could it be a bug on your side or is there something I'm missing?
I add the Bearer token to the HttpClient like so:
_client = new HttpClient();
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _tokenService.AccessToken);
Which seemed to work last week, and it is still working for getting Notebooks/Sections
EDIT: Requests + Responses
Request that works (getting sections):
GET https://www.onenote.com/api/v1.0/notebooks/0-2B36C9469D6FE2E!19159/sections HTTP/1.1
Authorization: Bearer EwB4Aq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAV1uu7Y2xsmzQFS/JyikQRMlK3+hurlsMQZTiYaefQ5ZVjZnnsB5bAeXFSUAGmNw4/B7DBk/tbjwWw5WzBFv0wdJERyLqCXU42WfpDKuHeZXZVS1p14teY0dr7OzN+G10Fn3/grWeHiRISlAqCBh6vV+qEO+11kFhxiCjERey6BJrMJVMCzMundN59uDM/jj8jJ9T7q2LlMqZQXFYra+DfrxWGCPzNMaJMRQYDpwrmov3kZlx2ZfL+k8Hv7luK7euEztfj5iTD4sJBCC2dURdysJdI//R0YRf5do94MyP2FD9dsLwhbl9qEhuJ+nxfVCja+s3d+GXggOBr29ivzbLYQDZgAACIabXCL9fNi6SAHeSujyYzD8QQdsytnb8nc2noza9JEWKr/tGHn2G/SofZBYrMEZCx5PBAKWghhWY40z2TCnD6MRgyFSBoqbGimNOkb7/vMHPgBUKJrxIgCgJmbW15IuYkZ11j7CK5+/JYyk+ufIjA8VEdl+HjDaUi35Hd9n8919XpQmHSH9aIZc8reC/7L90b5flE01i/ngXjuntxH92MKPm92+WVDuN9d4QWez6YEYpsBgynpx6BP8PfNbhu1E1LZUa9ZnwdBA1Pw0oYvC8jvfhx8bDhnZc2YMEQo/0XZSx5WUdVbBQfmU8gbQD86Ms3hm6fSVXxzzHIvMy0WR5Wpqr4A3+amUNFp6EApcCRI0Ydf+VLmiHHNcKWHGRaSUFDRsmaSlmmrQiBATtG4wJihywrkePrT4OBaJD/jVH9FvIZrLa33POSN1CLcFXlbKezyAYwE=
Accept: application/json
Host: www.onenote.com
Response:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; odata.metadata=minimal
Expires: -1
Server: Microsoft-IIS/8.5
X-CorrelationId: d3c85fde-c8e0-4e4e-a4df-87a3f57f146e
X-UserSessionId: d3c85fde-c8e0-4e4e-a4df-87a3f57f146e
X-OfficeFE: OneNoteServiceFrontEnd_IN_0
X-OfficeVersion: 16.0.6023.1561
X-OfficeCluster: neu-www.onenote.com
P3P: CP="CAO DSP COR ADMa DEV CONi TELi CUR PSA PSD TAI IVDi OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR"
X-Content-Type-Options: nosniff
Request-Processing-Time: 828.1859 ms
OData-Version: 4.0
Preference-Applied: odata.include-annotations=*
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 25 Jul 2015 12:10:58 GMT
Content-Length: 3135
{
"#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections(parentNotebook(id,name,self),parentSectionGroup(id,name,self))","value":[
{
"isDefault":false,"pagesUrl":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!41276/pages","name":"Agily","createdBy":"LnDSoft Test","lastModifiedBy":"LnDSoft Test","lastModifiedTime":"2015-07-23T11:39:46.9Z","id":"0-2B36C9469D6FE2E!41276","self":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!41276","createdTime":"2015-07-15T23:39:22.44Z","parentNotebook#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2141276')/parentNotebook(id,name,self)/$entity","parentNotebook":{
"id":"0-2B36C9469D6FE2E!19159","name":"Agily","self":"https://www.onenote.com/api/v1.0/notebooks/0-2B36C9469D6FE2E!19159"
},"parentSectionGroup#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2141276')/parentSectionGroup(id,name,self)/$entity","parentSectionGroup":null
},{
"isDefault":false,"pagesUrl":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!19161/pages","name":"AgilyTest","createdBy":"LnDSoft Test","lastModifiedBy":"M C","lastModifiedTime":"2015-07-21T23:16:18.85Z","id":"0-2B36C9469D6FE2E!19161","self":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!19161","createdTime":"2015-01-04T23:50:32.41Z","parentNotebook#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2119161')/parentNotebook(id,name,self)/$entity","parentNotebook":{
"id":"0-2B36C9469D6FE2E!19159","name":"Agily","self":"https://www.onenote.com/api/v1.0/notebooks/0-2B36C9469D6FE2E!19159"
},"parentSectionGroup#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2119161')/parentSectionGroup(id,name,self)/$entity","parentSectionGroup":null
},{
"isDefault":false,"pagesUrl":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!41275/pages","name":"OtherSection","createdBy":"LnDSoft Test","lastModifiedBy":"LnDSoft Test","lastModifiedTime":"2015-07-15T23:36:15.037Z","id":"0-2B36C9469D6FE2E!41275","self":"https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!41275","createdTime":"2015-07-15T23:35:13.9Z","parentNotebook#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2141275')/parentNotebook(id,name,self)/$entity","parentNotebook":{
"id":"0-2B36C9469D6FE2E!19159","name":"Agily","self":"https://www.onenote.com/api/v1.0/notebooks/0-2B36C9469D6FE2E!19159"
},"parentSectionGroup#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks('0-2B36C9469D6FE2E%2119159')/sections('0-2B36C9469D6FE2E%2141275')/parentSectionGroup(id,name,self)/$entity","parentSectionGroup":null
}
]
}
Request that does not work (getting pages, using the URL from above):
Request:
GET https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!19161/pages HTTP/1.1
Authorization: Bearer EwB4Aq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAV1uu7Y2xsmzQFS/JyikQRMlK3+hurlsMQZTiYaefQ5ZVjZnnsB5bAeXFSUAGmNw4/B7DBk/tbjwWw5WzBFv0wdJERyLqCXU42WfpDKuHeZXZVS1p14teY0dr7OzN+G10Fn3/grWeHiRISlAqCBh6vV+qEO+11kFhxiCjERey6BJrMJVMCzMundN59uDM/jj8jJ9T7q2LlMqZQXFYra+DfrxWGCPzNMaJMRQYDpwrmov3kZlx2ZfL+k8Hv7luK7euEztfj5iTD4sJBCC2dURdysJdI//R0YRf5do94MyP2FD9dsLwhbl9qEhuJ+nxfVCja+s3d+GXggOBr29ivzbLYQDZgAACIabXCL9fNi6SAHeSujyYzD8QQdsytnb8nc2noza9JEWKr/tGHn2G/SofZBYrMEZCx5PBAKWghhWY40z2TCnD6MRgyFSBoqbGimNOkb7/vMHPgBUKJrxIgCgJmbW15IuYkZ11j7CK5+/JYyk+ufIjA8VEdl+HjDaUi35Hd9n8919XpQmHSH9aIZc8reC/7L90b5flE01i/ngXjuntxH92MKPm92+WVDuN9d4QWez6YEYpsBgynpx6BP8PfNbhu1E1LZUa9ZnwdBA1Pw0oYvC8jvfhx8bDhnZc2YMEQo/0XZSx5WUdVbBQfmU8gbQD86Ms3hm6fSVXxzzHIvMy0WR5Wpqr4A3+amUNFp6EApcCRI0Ydf+VLmiHHNcKWHGRaSUFDRsmaSlmmrQiBATtG4wJihywrkePrT4OBaJD/jVH9FvIZrLa33POSN1CLcFXlbKezyAYwE=
Accept: application/json
Host: www.onenote.com
Response:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; odata.metadata=minimal
Expires: -1
Server: Microsoft-IIS/8.5
X-CorrelationId: fe872c95-f8af-41e3-b019-4e6504a5e8df
X-UserSessionId: fe872c95-f8af-41e3-b019-4e6504a5e8df
X-OfficeFE: OneNoteServiceFrontEnd_IN_0
X-OfficeVersion: 16.0.6023.1561
X-OfficeCluster: neu-www.onenote.com
P3P: CP="CAO DSP COR ADMa DEV CONi TELi CUR PSA PSD TAI IVDi OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR"
X-Content-Type-Options: nosniff
Request-Processing-Time: 703.1688 ms
OData-Version: 4.0
Preference-Applied: odata.include-annotations=*
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 25 Jul 2015 12:10:58 GMT
Content-Length: 143
{
"#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/sections('0-2B36C9469D6FE2E%2119161')/pages","value":[
]
}
EDIT 2: Still not working
Request:
GET https://www.onenote.com/api/v1.0/sections/0-2B36C9469D6FE2E!19161/pages HTTP/1.1
Authorization: Bearer EwCAAq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAAZdDnoj6ATyof3wJ8jfSPNcSx+uxW4fVURSJ29iChWlIuhitDH11wKItykmBolKwHRyINjz4+dknXJcNfHgGv6R7AOpSeuNt/lr+h/9HUS20/aV0/NssaoXh7lyGKQekX22D+KtcprNi9zoXbtR6t07tz7aHyx3V7F4qHQVZmG2psWTGVpwa/TTCLB4jgDCEHwQYV9XgjGnpIJgyIZvmI+hZ0DRkBF9gyp49BMNrgdi75jLyfecbYU1MaxBdaUQuhZFXjGEv8pMecsscGcLM9JvbtT6Ap6k6mQv5D6GeCe/CHxgQO+3IoXXRLG/n61eGHpf8/WbQorzeCDnbbtcSkCYDZgAACPGa/3ibM+sXUAHc/d8IiDQnNRQHYfY/sl7b179y4gRsnP5YUN7dI7CkNkFR4sSWo1Db9tBmZN3bA4LN94D4GEzDhegNrjXtm5NFrrhrGOInZzFxtlfRVa1GvgPgPc2s8clOacwE5zi2jr1SSf39AfJjBYfMK2ePYN8XRdzjBMfAXZFHv0MOIk3pAbE/Tk0YSPqRk1whxHrLFxkYvk5PI8IoWsyKIUudp7B2GwvWAE2WycX2P49yJs4qZ/+Ocu/k0jJv16kUa/szN4G8lmcEZykiKrLgGFxZbfKn8L9/sECD7Wj5X0pxH4aDnvUrcjsFNrreanAeG+KyLsHdhOL3UIy/uiLRsarLsdXmlUV2JGHdGiAdZ53wR+xKOYq7xoBP7myhxIoFoqnm7wVnKi8+2CiA8T9y+JtVToQMxjTD1xacuuZ8malpifqTTHYYXmggOaukHOcsV0TQz4JjAQ==
Accept: application/json
Host: www.onenote.com
Response:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; odata.metadata=minimal
Expires: -1
Server: Microsoft-IIS/8.5
X-CorrelationId: 7cb781ec-36d4-4485-b6c1-a48f7e536298
X-UserSessionId: 7cb781ec-36d4-4485-b6c1-a48f7e536298
X-OfficeFE: OneNoteServiceFrontEnd_IN_5
X-OfficeVersion: 16.0.6023.1561
X-OfficeCluster: neu-www.onenote.com
P3P: CP="CAO DSP COR ADMa DEV CONi TELi CUR PSA PSD TAI IVDi OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR"
X-Content-Type-Options: nosniff
Request-Processing-Time: 671.9287 ms
OData-Version: 4.0
Preference-Applied: odata.include-annotations=*
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 28 Jul 2015 02:21:40 GMT
Content-Length: 143
{
"#odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/sections('0-2B36C9469D6FE2E%2119161')/pages","value":[
]
}
You can see in the below screenshot that pages exist
for Agily (Notebook) -> Agily (Section)
I have been investigating this issue for you today. I was wondering if you could try this request again?
Our storage layer experienced some failures over the weekend that could possibly explain the issue so I wanted to verify with you that you are seeing the issue still.
As far as I can tell from the request that you posted and the logs on our end, there is nothing wrong syntactically with the request and no obvious logic errors on our end, so the investigation is currently pointing at the storage layer as possibly being the culprit.
Thanks,
Daniel

Google Drive: Error in retrieving access and refresh tokens

I am trying to access google drive from my app for WP7. But when i try to get access token in exchange for Authorization code, I get BAD REQUEST from server.
My POST request as seen in Fidler:
POST https://accounts.google.com/o/oauth2/token HTTP/1.1
Accept: */*
Referer: file:///Applications/Install/7128457C-3AF4-41C4-A606-742068B1463F/Install/
Content-Length: 240
Accept-Encoding: identity
Content-Type: application/x-www-form-urlencoded
User-Agent: NativeHost
Host: accounts.google.com
Connection: Keep-Alive
Cache-Control: no-cache
code=<*Authorization_Code*>&
client_id=<*My_Client_Id*>&
client_secret=<*My_Client_Secret*>&
redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&
grant_type=authorization_code
Response from server:
HTTP/1.1 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Sat, 07 Sep 2013 14:05:35 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Transfer-Encoding: chunked
21
{
"error" : "invalid_request"
}
0
My Code:
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}", "code", HttpUtility.UrlEncode(AuthorizationCode));
postData.AppendFormat("&\n{0}={1}", "client_id", HttpUtility.UrlEncode(ClientId));
postData.AppendFormat("&\n{0}={1}", "client_secret", HttpUtility.UrlEncode(ClientSecret));
postData.AppendFormat("&\n{0}={1}", "redirect_uri", HttpUtility.UrlEncode("urn:ietf:wg:oauth:2.0:oob"));
postData.AppendFormat("&\n{0}={1}", "grant_type", HttpUtility.UrlEncode("authorization_code"));
WebClient client = new WebClient();
client.UploadStringCompleted += TokenResponse;
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
client.UploadStringAsync(new Uri("https://accounts.google.com/o/oauth2/token",UriKind.Absolute), "POST", postData.ToString());
I get this result both on emulator as well as Lumia 820. I also tried without using HttpUtility in POST request but didn't work. Any help?
Its likely due to the fact that you are adding a new line via \n between all the param/value pairs.
I do it without that without it and it works - https://github.com/entaq/GoogleAppsScript/blob/master/IO2013/YouTubeAnalytics/oauth2.gs#L25

Acquire Twitter request token failed

I followed the instruction at http://dev.twitter.com/pages/auth#request-token, and developed a c# class to do the OAuth authorization. I used the parameters on the page, and the output signature base string and signature match that on the page. So I think the algorithm part is correct. Then I replaced the parameters with the ones in my twitter application, but I failed to acquire the request token from Twitter service. And the response data is "Failed to validate oauth signature and token".
Here's the request I send (I used http, instead of https for debug):
POST http://api.twitter.com/oauth/request_token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_callback="http%3A%2F%2Flocalhost%3A3005%2Fthe_dance%2Fprocess_callback%3Fservice_provider_id%3D11", oauth_consumer_key="GDdmIQH6jhtmLUypg82g", oauth_nonce="QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1272323042", oauth_version="1.0", oauth_signagure="IP%2FEEoc4tKdiobM%2FKH5cPK69cJM%3D"
Host: api.twitter.com
Proxy-Connection: Keep-Alive
And here's the response:
HTTP/1.1 401 Unauthorized
Connection: Keep-Alive
Connection: Proxy-Support
Content-Length: 44
Via: 1.1 APS-PRXY-09
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Date: Fri, 08 Apr 2011 05:47:20 GMT
Content-Type: text/html; charset=utf-8
Server: hi
Proxy-Support: Session-Based-Authentication
Status: 401 Unauthorized
X-Transaction: 1302241640-40339-46793
Last-Modified: Fri, 08 Apr 2011 05:47:20 GMT
X-Runtime: 0.01519
Pragma: no-cache
X-Revision: DEV
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Set-Cookie: k=207.46.55.29.1302241640766556; path=/; expires=Fri, 15-Apr-11 05:47:20 GMT; domain=.twitter.com
Set-Cookie: guest_id=13022416407746962; path=/; expires=Sun, 08 May 2011 05:47:20 GMT
Set-Cookie: _twitter_sess=BAh7CDoPY3JlYXRlZF9hdGwrCEiBpjMvAToHaWQiJWMzMTViOGZiNDkzMDRi%250ANjNhMmQwYmVkZDBhNTc2NTc4IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy%250AOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--177afd5c0f6fe30005ab9a9412e6f85ab03cbfa7; domain=.twitter.com; path=/; HttpOnly
Vary: Accept-Encoding
Failed to validate oauth signature and token
This is how I generate the normalized parameters:
string.Join("&", (from d in this.BuildParameterDict()
select string.Format("{0}={1}", OAuthEncoding.Encode(d.Key), OAuthEncoding.Encode(d.Value))))
The BuildParameterDict method will sorted build a list with: parameters from query string; parameters from body; parameters sepcific to 'oauth', except the 'oauth_signature'.
Then the signature base string is generated by:
StringBuilder sb = new StringBuilder();
sb.Append(OAuthEncoding.Encode(this._request.Method));
sb.Append('&');
sb.Append(OAuthEncoding.Encode(this.GetNormalUri()));
sb.Append('&');
sb.Append(OAuthEncoding.Encode(this.GetNormalParameters()));
This is the generated base string with parameters from the above page:
POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Flocalhost%253A3005%252Fthe_dance%252Fprocess_callback%253Fservice_provider_id%253D11%26oauth_consumer_key%3DGDdmIQH6jhtmLUypg82g%26oauth_nonce%3DQP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1272323042%26oauth_version%3D1.0
which is identical to the string on that page.
Your oauth signature is listed as "oauth_signagure" in your request.
oAuth parameters has to be sorted before sending, but signature has to be at the end of the authorization request.(9.1.1 in http://oauth.net/core/1.0/#anchor14)
You may also need to specify a realm="/oauth/request_token". It's optional, but as I remember correctly Twitter wants this one for a request token.
If you can add your code we might find what's going on, as you might not be building your request and key for signature hashing correctly.

Search for base64 encoded content in StreamReader?

I need to parse a NDR file from an SMTP badmail folder from IIS. Attached to the NDR is the content which is base64 encoded. That is what I need to get to. I was hoping that, using a StreamReader, it would be all one line, but they are separate lines when a perforam a .ReadLine.
Here is a sample of an NDR:
From: postmaster
To: hidden
Date: Thu, 12 Nov 2009 11:56:14 -0500
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="9B095B5ADSN=_01CA638BF4740C5500000045spinstitch.com"
X-DSNContext: 7ce717b1 - 1378 - 00000002 - C00402EF
Message-ID:
Subject: Delivery Status Notification (Failure)
This is a MIME-formatted message.
Portions of this message may be unreadable without a MIME-capable mail program.
--9B095B5ADSN=_01CA638BF4740C5500000045spinstitch.com
Content-Type: text/plain; charset=unicode-1-1-utf-7
This is an automatically generated Delivery Status Notification.
Delivery to the following recipients failed.
hidden
--9B095B5ADSN=_01CA638BF4740C5500000045spinstitch.com
Content-Type: message/delivery-status
Reporting-MTA: dns;spinstitch.com
Received-From-MTA: dns;spinstitch
Arrival-Date: Thu, 12 Nov 2009 11:56:11 -0500
Final-Recipient: rfc822;hidden
Action: failed
Status: 5.4.0
--9B095B5ADSN=_01CA638BF4740C5500000045spinstitch.com
Content-Type: message/rfc822
Received: from mail pickup service by spinstitch.com with Microsoft SMTPSVC;
Thu, 12 Nov 2009 11:56:11 -0500
MIME-Version: 1.0
From: hidden
To: hidden
Date: 12 Nov 2009 11:56:11 -0500
Subject: For Sale: 463 Saltaire Dr. Calabash, NC US 28467 $6,800,000
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
Message-ID:
X-OriginalArrivalTime: 12 Nov 2009 16:56:11.0813 (UTC) FILETIME=[09CED550:01CA63B9]
DQo8Y2VudGVyPg0KPGltZyBpZD0idHJJTUciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHNyYz0i
aHR0cDovL3NlcnZpY2VzLnNwaW5zdGl0Y2guY29tL3RyaW1nLmFzcHg/Z2V0SW1nPUswaXg0
cDJkZ1c4b3ozRmZBNE5GcmJxVmFoUTZpOWd2Z2ZlZmVWcjhSZkVhamdnamFYUnROMWU2RW15
OG5ic0dUbWMxOEo0UnlhMS81WVFvaFhraFA2VTNFcTRFRHB4R1J4YmpjeXlhOG56aExKT2hD
M0QzL3RWNVh6ZmxWNkphIj4NCjxkaXYgc3R5bGU9IndpZHRoOjEwMCU7IGJhY2tncm91bmQ6
IHVybChodHRwOi8vd3d3LnNwaW5zdGl0Y2h0b3Vycy5jb21GaWxlcy9WaWV3ZXJTa2lucy9C
YWNrZ3JvdW5kcy9EZWZhdWx0L2JhY2suanBnKTsgYmFja2dyb3VuZC1hdHRhY2htZW50OmZp
eGVkOw0KCWJhY2tncm91bmQtcmVwZWF0OnJlcGVhdC15Ow0KCWJhY2tncm91bmQtcG9zaXRp
b246dG9wIGNlbnRlcjsNCgliYWNrZ3JvdW5kLWNvbG9yOiM3YTZmNTM7Ij4NCjx0YWJsZSB3
aWR0aD0iNjEyIiBib3JkZXI9IjAiIGNlbGxzcGFjaW5nPSIwIiBjZWxscGFkZGluZz0iMCI+
DQogIDx0cj4NCiAgICA8dGQgd2lkdGg9IjUyOSIgYWxpZ249ImxlZnQiPjx0YWJsZSB3aWR0
aD0iMjAwIiBib3JkZXI9IjAiIGNlbGxzcGF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yMDA5IFNwaW5TdGl0Y2ggTExDIDExMTAgQmFzaWxk
b24gUmQuIE10LiBQbGVhc2FudCwgU0MgIDI5NDY2PC9zcGFuPg0KPC9kaXY+DQo8L2NlbnRl
cj4NCg==
--9B095B5ADSN=_01CA638BF4740C5500000045spinstitch.com--
This regular expression matches your base64 string and decode it:
Match m = Regex.Match(
File.ReadAllText(#"c:\edit1.txt"),
#"X-OriginalArrivalTime:.*?\r\n\r\n([\s\S]*)\r\n\r\n");
byte[] data = Convert.FromBase64String(m.Groups[1].Value);
If you prefer do not to use regular expressions, you could try to skip every line until you find that X-OriginalArrivalTime header. From there, you can keep every line until you find an empty line, or stream end.
Try using the Read() method instead.

Categories