Last active
August 29, 2015 14:10
-
-
Save malkitsingh/dbcf1479679d2f958529 to your computer and use it in GitHub Desktop.
to allow cross site service call for web api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<!-- Adding the following custom HttpHeader will help prevent CORS from stopping the Request--> | |
<add name="Access-Control-Allow-Origin" value="*" /> | |
</customHeaders> | |
</httpProtocol> | |
</system.webServer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public StringResult fdfriendstestservice() | |
{ | |
//WebClient wc = new WebClient(); | |
//string NoochAppAccessToken = Utility.GetValueFromConfig("NoochFBAppAccessToken");// CAAC0VZAIiwsEBAEceki7EWz7UryKqsrtZC9cP0KDptv9MlZCCHdL0rU6nXpYJGfL6XoCDRYntjGN1NEiNypIYyeZBBkPlSiFwUeTZBXDqRXU1wiF5ggqrHLUxPANyAz8RGqZCkZAwxa3f4eqjjuL0EipDeOjxNQatTWU94inMjYkNwwOxomyYZBy8KoZCYxNYtGyiyeZBWT6ucTnbcFLBVEG7K | |
//string urlString = "https://graph.facebook.com/v2.2/" + "1212400310" + | |
// "/friends/?key=value&access_token=" + NoochAppAccessToken; | |
//string fbGraphResultString = wc.DownloadString(urlString); | |
//FBResponseClass fbGraphResults = JsonConvert.DeserializeObject<FBResponseClass>(fbGraphResultString); | |
// to test google url shortner | |
string longurltpshorten = "https://developers.google.com/url-shortener/v1/getting_started#shorten"; | |
var cli = new WebClient(); | |
cli.Headers[HttpRequestHeader.ContentType] = "application/json"; | |
string response = cli.UploadString("https://www.googleapis.com/urlshortener/v1/url", "{longUrl:\""+longurltpshorten+"\"}"); | |
googleURLShortnerResponseClass fbGraphResults = JsonConvert.DeserializeObject<googleURLShortnerResponseClass>(response); | |
return new StringResult { Result = "sd"}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To upload file | |
http://davidsonsousa.net/en/post/how-to-upload-a-file-using-mvc-3-and-ajax | |
to begin with angular js and phonegap | |
http://tech.pro/tutorial/1336/phonegap-and-angularjs-the-start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment