I'm running into a problem with an optional regex clause (\.ashx)? in an ASP.NET MVC route
routes.IgnoreRoute("resizer\\.debug(\\.ashx)?");
routes.IgnoreRoute("[^?]+\\.(psd|bmp|gif|exif|png|tif|tiff|tff|jpg|jpeg|jpe|jif|jfif|jfi)(\\.ashx)?");
I get the error
The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.
Parameter name: routeUrl
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.
Parameter name: routeUrl
[ArgumentException: The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character.
Parameter name: routeUrl]
System.Web.Routing.RouteParser.Parse(String routeUrl) +21953
System.Web.Routing.Route.set_Url(String value) +12
System.Web.Routing.Route..ctor(String url, IRouteHandler routeHandler) +9
System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url, Object constraints) +106
System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url) +6
MvcApplication2.MvcApplication.RegisterRoutes(RouteCollection routes) in C:\Users\Administrator\Documents\resizer\Tests\Hidden\MvcApplication2\Global.asax.cs:15
MvcApplication2.MvcApplication.Application_Start() in C:\Users\Administrator\Documents\resizer\Tests\Hidden\MvcApplication2\Global.asax.cs:29
How do you do optional regex groups in MVC routes?
You could try:
http://www.iridescence.no/post/Defining-Routes-using-Regular-Expressions-in-ASPNET-MVC.aspx
Related
I use Jmeter Backend Listener url:
influxdbUrl = http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
I get an error:
java.lang.IllegalStateException: Failed calling setupTest Caused by: java.net.URISyntaxException: Illegal character in query at index 76: http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
Problem in special characters in password: C-UBBC-"<
How to fix it?
Not every character is allowed in an URL, you can use alphanumeric and few special ones, in particular ; , / ? : # & = + $ - _ . ! ~ * ' ( ) #. Everything else needs to be percent-encoded
Wrap your password into __urlencode() function and it should resolve your issue.
More information on JMeter Functions concept: Apache JMeter Functions - An Introduction
I am having the below error while deploying Jupiterhub
Spawn failed: (422) Reason: error HTTP response headers:
,"status":"Failure","message":"PersistentVolumeClaim "" is invalid: [metadata.name: Required value: name or generateName is required, metadata.labels: Invalid value: "-42hattacharjee-5f-5f-41nusuya": a valid label must be an empty string or consist of alphanumeric characters, '-', '' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9.]*)?[A-Za-z0-9])?')]",
I have tried removing the username from the "pvcNameTemplate" parameter but still getting this error.
I have a SpringBoot application. On one of the POST endpoints, in the body I want a field that can contain emoji.
In my request object I have the following field:
private final String name;
In the body of my request I have the following input:
"name" : "Hello, playground \Ud83d\Ude0a \Ud83e\Udd21\Ud83d\Udc68\U200d\Ud83c\Udf73 \U2663\Ufe0f"
which contains some emojis.
The exception I get is:
com.fasterxml.jackson.databind.JsonMappingException: Unrecognized character escape 'U' (code 85)
and
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized character escape 'U' (code 85)
I tried to set the following flag on my object mapper with no luck:
.configure(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true)
Any ideas?
I'm having some problems getting the __VIEWSTATE and __EVENTVALIDATION parameters.
I'm using a post procesor Regular Expression Extractor and configuring them as follows:
Reference Name: aspViewstate
Regular Expression: name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"
Template: $1$
Match No. (0 for Random): 1
Default value: ERROR_VIEWSTATE
Reference Name: aspEventValidation
Regular Expression: name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"
Template: $1$
Match No. (0 for Random): 1
Default value: ERROR_EventValidation
Then, Im replacing in the http request the values of each parameters for ${aspViewstate} and ${aspEventValidation} respectively.
I'm putting the Regular Expression Extractors below the GET request and before the POST request.
I'm including a Debug Sampler and Im getting the "error result":
aspEventValidation=ERROR_EventValidation
aspViewstate=ERROR_VIEWSTATE
Please can any one help me about what I'm missing....
UPDATE:
I'm getting the __VIEWSTATE using the CSS/JQuery Extractor like follow and is working:
CSS/JQuery Extractor Implementation:JSOUP
Reference Name: aspViewstate
CSS/JQuery Expression: input[id=__VIEWSTATE]
Attribute: value
Template: $1$
Match No. (0 for Random): 0
Default value: ERROR
but for the __EVENTVALIDATION is not working, and Im using the same sintax:
CSS/JQuery Extractor Implementation:JSOUP
Reference Name: aspEventValidation
CSS/JQuery Expression: input[id=__EVENTVALIDATION]
Attribute: value
Template: $1$
Match No. (0 for Random): 0
Default value: ERROR
I don't know what is failing...
About the VIEWSTATE Im getting already the value but the system is sending me the following error, is like is not sending the VIEWSTATE...
Error:
<code><pre>
[FormatException: The input is not a valid Base64 string that contains a character that is not Base 64, more than two filler characters or an invalid character among the padding characters . ]
System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) +14115992
System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +162
System.Convert.FromBase64String(String s) +56
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +102
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +67
System.Web.UI.HiddenFieldPageStatePersister.Load() +200
[ViewStateException: View state invalid
Client IP:
Port:
Referer: http://Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
Path: /Art/WebLogiPortal/wfmLoginD.aspx
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
ViewState: ${aspViewstate}]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +157
System.Web.UI.HiddenFieldPageStatePersister.Load() +12060517
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +12315765
System.Web.UI.Page.LoadAllState() +51
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308619
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308137
System.Web.UI.Page.ProcessRequest() +119
System.Web.UI.Page.ProcessRequest(HttpContext context) +99
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
</pre></code>
I added a Debug Post procesor and I realized that the sent value to the server was litterally the characters of the variable (i.e ${viewstate}) and not the value, not even the default value (error).
What can possibly be happening ?
Here is the Response date of the Debug Post procesor:
HTTPSampler.response_timeout=
HTTPSampler.use_keepalive=true
HTTPsampler.Arguments=wucLoginPortal_ScriptManager1_HiddenField=&__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=${aspViewstate}&__VIEWSTATEGENERATOR=${viewstateGenerator}&__EVENTVALIDATION=${aspEventValidation}&wucLoginPortal$__LBLHDN__=&wucLoginPortal$txtLoginAD=user1&wucLoginPortal$txtPasswordAD=user1&wucLoginPortal$txtDominioAD=art.com&wucLoginPortal$btnAceptarAD=Aceptar
TestElement.enabled=true
TestElement.gui_class=org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui
TestElement.name=4 /Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
TestElement.test_class=org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy
TestPlan.comments=Detected the start of a redirect chain
I wouldn't recommend using Regular Expression Extractor to fetching viewstate and eventvalidation values as in case of changing attributes location, or being on multiple lines or having an extra space may cause your regex to fail.
JMeter provides 2 test elements designed to extract values from HTML pages, they are:
XPath Extractor
CSS/JQuery Extractor
Example XPath locator will look like:
//input[#id='__VIEWSTATE']/#value
Example CSS selector will be
input[id=__VIEWSTATE]
specify value in "Attribute" input
See ASP.NET Login Testing with JMeter guide for more details and recommendations.
Setuping a staticMatic project using /index.html:
#slug = current_page.gsub(/\.html/, '')
returns "/index(.html)", but should be /index
Changing term corrects: - #slug = current_page.gsub("/", "").gsub(".html", "") as found in:
https://github.com/adamstac/staticmatic-bootstrap/blob/master/src/helpers/application_helper.rb
To delete the beginning "/" after you've stripped the html simply execute this (which will do both in one command):
current_page.gsub(/\.html/, '').gsub(/\//,''))