Using Special Symbols in ASP.NET MVC Routes [duplicate] - asp.net

This question already has answers here:
ASP.NET MVC: Route with optional parameter, but if supplied, must match \d+
(6 answers)
Closed 9 years ago.
I want to use the url such as "/ControllerName/ActionName/Id"
Id - only digits or null.
But when I use regular expression in MapRoute, "\d{1,4}", I see the exception - error404 page, when I'm trying to see /ControllerName/ActionName/" page.
Also, I don't know, how I can catch exception with special symbol - ".
Please, help.Thanx.

Try using ( *|\d{1,4}).

Related

Servlet unable to get hash fragment from URL [duplicate]

This question already has answers here:
Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?
(12 answers)
How to get Url Hash (#) from server side
(6 answers)
Closed 1 year ago.
Hi after redirection from OAuth server, I am unable to get the complete URL in my JAVA Servlet.My URL looks like below -
https://host.vp.com/gui/MainPage.gdi#scope=openid%20profile&id_token=eyJ0eXAiOiJKV86sada0ajdasJUUEB343KHFKK
I tried request.getRequestURL() , request.getRequestURL(), request.getPathInfo(), no luck in getting the part of the URL which starts after #, i.e., scope=openid%20profile&id_token=eyJ0eXAiOiJKV86sada0ajdasJUUEB343KHFKK, Can someone help me here?
Your Query string should start with ? instead of # to be able to read in the Selvlet.

Karate; Multiple urls in a single scenario [duplicate]

This question already has an answer here:
Karate API Testing - Reusing variables in different scenarios in the same feature file
(1 answer)
Closed 2 years ago.
This is a followup from a previous question I asked Using response data from one scenario to another
I am looking to take information from a response in one url, then use it in a second url for another assertion.
Something like this:
Scenario: Search for asset
Given url "https://foo.bar.buzz"
When method get
Then status 200
* def responseItem = $.items[0].id // variable initialized from the response
Given url "https://foo.bar.buzz/" + responseItem + "/metadata"
// making request payload
When method put.....
Right now when I run this, it gets hung up on the second Given statement.
Any thoughts on how to resolve this?
As you probably figured out, the "Karate HTML report" will show you the request/response and headers, as long as you put DEBUG log level in your log4j config, and that will answer your question.

Does asp.net can capture Url param as Variable like flask? [duplicate]

This question already has answers here:
Routing with Multiple Parameters using ASP.NET MVC
(3 answers)
Closed 4 years ago.
for example, flask can get param in url:
".com/<name>/<token>"
get 'name' and 'token' as Variable .
Does asp.net can do this?
You can use attribute routing in ASP.Net Web API and should use the Route attribute
[HttpGet]
[Route("GetSomething/{name}/{token})"]
public MyResponse GetSomething(string name, string token)
{
...
}

difference between 'Response.Redirect' and 'Server.Tansfer' [duplicate]

This question already has answers here:
Server.Transfer Vs. Response.Redirect
(16 answers)
Closed 9 years ago.
Everyone,I must launch my code,
The first way:
Response.Write("<script>alert('Succeed,Will be redirect to the target page')</script>");
string path = Server.MapPath(#"~\Forms\MainForm_SQL.aspx");
Response.Redirect(path);
The second way:
Response.Write("<script>alert('Succeed,Will be redirect to the target page')</script>");
Server.Transfer(#"~\Forms\MainForm_SQL.aspx");
Now,back to the issue,The question is :
01)it works nothing when using the 'first way',That is, it either alerts the message nor goes into the 'Page_Load' of the target page.
02),when use the second way,it first goes into the 'Page_Load' of the target,than it goes back to alert the message.
why it that so unreachable to track the architecture ? can some one help me please?
thanks.
IIRC, Server.Transfer is internal -- that is, it hands off processing to the destination without bouncing the client to another page -- whereas Response.Redirect tells the client to go to the new URL.

ASP "Cannot use parentheses when calling a Sub " [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Cannot use parentheses when calling a Sub
As far as I am aware this is correct but i get the error "Cannot use parentheses when calling a Sub"
Never used ASP before...can anyone shed light o nthe issue for me? code:
<%TESTWeb1.RecentlyViewedDisplay("Recently Viewed Header","Recently Viewed Entry","Recently Viewed Group Entry")%>
In VB6 type languages you only need parentheses when calling a function, or when calling a sub using the Call keyword.
e.g.
DoSoemthing "foo","baa"
Call DoSomething("foo","baa")
myVar = DoSomething("foo","bar")
I think in your case taking the parentheses out of the call should work (although I can't check as I don't have an ASP configured environment handy.

Resources