RBS
asked on
How to create and go to MVC endpoint with Javascript
Hi:
I have an MVC app in which I am doing a lookup in javascript and would like the program to take me to the following endpoint:
I have a have a javascript function that looks like this:
My problem is that this function takes me to:
and tells me that "A potentially dangerous Request.Path value was detected from the client"
I have tried escaping the '?' character but that does not seem to work. Any assistance on how to make this function take me to the endpoint that I want to go to greatly appreciated..
RBS
I have an MVC app in which I am doing a lookup in javascript and would like the program to take me to the following endpoint:
http://localhost:44328/Admin/ManageUsers/UserDetails/?username=jsmith
I have a have a javascript function that looks like this:
window.SalesHub.SearchBox_Select = function(e) {
var baseUrl = 'http://localhost:44328';
var actionUrl = '/Admin/ManageUsers/UserDetails/\?username=';
var userName = 'jsmith';
window.location.pathname = baseUrl + actionUrl + userName ;
}
My problem is that this function takes me to:
http://localhost:44328/Admin/ManageUsers/UserDetails/%3Fusername=jsmith
and tells me that "A potentially dangerous Request.Path value was detected from the client"
I have tried escaping the '?' character but that does not seem to work. Any assistance on how to make this function take me to the endpoint that I want to go to greatly appreciated..
RBS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The pathname starts after the hostname and port and ends before the querystring. It cannot contain a question mark. That's why it is escaped.