Question: I’m currently building an ASP.NET MVC 5 EF6 blogging web application.

I have two databases and contexts :

-a database for the actual data of my application (blog posts, blog categories, tags, etc) .

-a database for authentification and membership purpose (users and roles).

I am able to authorize a given user the right to add/edit/delete blog posts, using the authorize attribute in the BlogPostcontroller :
 [Authorize(Roles=”Administrator,Author”)] 
and it works pretty well..

MY GOAL : let’s imagine I want to grant an user the right to add/edit/delete a subset of all the blog post or blog categories (let’s say only to the “Cooking” and “travel” blog categories). 

I started to think about creating a navigation property between the user and the blog category entities, but apparently foreign keys between two separate databases are not supported by the entity framework.

Do you guys have an idea of a walk-around for this problem? 

Your help will be much appreciated.

Answer: 
Tru to use URLEncoder. For exmaple:

```
song_url = URLEncoder.encode(song_url);

```

Also you can provide `song_url` as datasource directly:

```
mediaPlayer.setDataSource(song_url);
mediaPlayer.prepare(); 

```
Try this..

You can use the `java.net.URLEncoder` to **encode** the **URL**

space need to replace with `%20` use below method to use your url **[URLEncoder](http://docs.oracle.com/javase/6/docs/api/java/net/URLEncoder.html)**

**imports**

```
import android.webkit.URLUtil;
import android.util.Patterns;
import java.net.URLEncoder;

```

**Codes**

```
try {
     if(URLUtil.isValidUrl(song_url) || Patterns.WEB_URL.matcher(song_url).matches()) {
             song_url = URLEncoder.encode(song_url,"UTF-8");    
             url = new URL(song_url);   

            // so on                
     } else {
             Toast.makeText(getBaseContext(), "Please enter valid URL.", Toast.LENGTH_SHORT).show();
     }
    }

```