---
title: "How to get Browser Url value in razor view"  
description: "How to get Browser Url value in razor view"  
author: "Anonymous User"  
published: 2017-12-14  
updated: 2017-12-14  
canonical: https://www.mindstick.com/forum/34395/how-to-get-browser-url-value-in-razor-view  
category: "c#"  
tags: ["asp.net mvc", "mvc", "mvc4", "razor"]  
reading_time: 2 minutes  

---

# How to get Browser Url value in razor view

Hi,

I want to get [Url](https://www.mindstick.com/forum/436/url-redirection) [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) in my [razor view](https://www.mindstick.com/forum/155820/how-to-generate-textbox-control-using-htmlhelper-in-razor-view) for applying an [condition](https://www.mindstick.com/forum/12711/select-query-with-and-condition) on [dropdown list](https://www.mindstick.com/forum/760/dropdown-list-open-hide-behind-another-dropdown-list-on-ie-7).

Here is my code.

```
 <div class="col-md-7">
                    <label>Filter By:</label>
                    <select id="filterby" name="FilterBy" style="width: 150px; height: 40px; border: 1px solid #ced4da; border-radius: .25rem;">
                        <option value="name" selected="Condition For Selected item">Name</option>
                        <option value="email" selected="Condition For Selected item">E-mail</option>
                    </select>
                </div>
```

Please give me solution to accomplish this task....

## Replies

### Reply by Hemant Patel

Hi Sara,

You can use Request.QueryString to get Url data in your [razor](https://www.mindstick.com/articles/12002/asp-dot-net-mvc5-razor-with-jquery) [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view).

Please rewrite your code like this :

```
 <div class="col-md-7">
                    <label>Filter By:</label>
                    <select id="filterby" name="FilterBy" style="width: 150px; height: 40px; border: 1px solid #ced4da; border-radius: .25rem;">
                        <option value="name" selected="@(Request.QueryString["UrlFieldValueName"] == "CompareValueName" ? true : false)">Name</option>
                        <option value="email" selected="@(Request.QueryString["UrlFieldValueName"] == "CompareValueName" ? true : false)">E-mail</option>
                    </select>
                </div>
```

I hope this answer is useful for you...


---

Original Source: https://www.mindstick.com/forum/34395/how-to-get-browser-url-value-in-razor-view

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
