What’s a redirect URI? how does it apply to iOS app for OAuth2.0?

Beginner programmer here, please pardon ignorance & explanations will be really nice 🙂 I’ve tried to read the tutorials for a certain OAuth 2.0 service, but I don’t understand this redirect URI… in my particular context, let’s say I’m trying to build an iPhone app that uses OAuth 2.0 for some service. I have an … Read more

How can I get the baseurl of site?

I want to write a little helper method which returns the base URL of the site. This is what I came up with: public static string GetSiteUrl() { string url = string.Empty; HttpRequest request = HttpContext.Current.Request; if (request.IsSecureConnection) url = “https://”; else url = “http://”; url += request[“HTTP_HOST”] + “https://stackoverflow.com/”; return url; } Is there … Read more

Get real path from URI, Android KitKat new storage access framework [duplicate]

This question already has answers here: Android Gallery on Android 4.4 (KitKat) returns different URI for Intent.ACTION_GET_CONTENT (20 answers) Closed 7 years ago. Before the new gallery access in Android 4.4 (KitKat) I got my real path on the SD card with this method: public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; … Read more

Get file name from URI string in C#

I have this method for grabbing the file name from a string URI. What can I do to make it more robust? private string GetFileName(string hrefLink) { string[] parts = hrefLink.Split(“https://stackoverflow.com/”); string fileName = “”; if (parts.Length > 0) fileName = parts[parts.Length – 1]; else fileName = hrefLink; return fileName; } 9 Answers 9

Convert file path to a file URI?

Does the .NET Framework have any methods for converting a path (e.g. “C:\whatever.txt”) into a file URI (e.g. “file:///C:/whatever.txt”)? The System.Uri class has the reverse (from a file URI to absolute path), but nothing as far as I can find for converting to a file URI. Also, this is not an ASP.NET application. 7 Answers … Read more

.NET – Get protocol, host, and port

Is there a simple way in .NET to quickly get the current protocol, host, and port? For example, if I’m on the following URL: http://www.mywebsite.com:80/pages/page1.aspx I need to return: http://www.mywebsite.com:80 I know I can use Request.Url.AbsoluteUri to get the complete URL, and I know I can use Request.Url.Authority to get the host and port, but … Read more