How to redirect a page in sightly without html tags. Apart from "meta" command - sightly

I need to know about the redirection happen in sightly. Can someone help me with the code. I dont want http://www.indiana.edu/~account/new-directory"> as this will be configured in head of html.
For me requirement in sightly.

Sightly is a templating language only!
If you want a redirect, implement it in your controller Java class.
See Request Response API for that. https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/org/apache/sling/api/SlingHttpServletResponse.html
The WCMUse classes have access to the response object, here is the API : https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/cq/sightly/WCMUse.html
The redirection after that is just pure Java Servlet redirection.
Hope this will help.

Related

how to restrict html tags in query string in mvc

how to handle request when user directly enters html content in URL.
I want to redirect to Error page when user enters html tag in URL is that possible in MVC.
I have tried from BeginExecute event of by creating override method.
Please give some suggestion.
Thanks.
meybe can use RouteHandler for when a user needs to redirect to any
external page, shorten long URLs, or make URLs more user friendly.
please check my answer
Error handling ASP.NET MVC
You can always choose CustomErrorMode="On" in web.config and configure with your error controller
Custom Error Mode will help you to redirect any invalid or malicious link or content to redirect it to your errorcontroller and handle it the way you want.
You can use Request validation for do it. It prevents to accept un-encoded HTML/XML etc from Client to server. It validates all the data that is passed from client to server. To use this feature , you must set requestValidationMode as 4.5 in web.config like:
<httpruntime requestvalidationmode="4.5" />
For more information please see this article.

In rails app who respond according to the http request?

Well, so far in each article I see people say server respond accordingly to the request type. If it is xml request then response is in xml and if it is ajax or html then response is in ajax or html. Browser send the request and server respond accordingly. My question is in rails app in which part this decision is taken? That is by server which part of the rails app we indicate?
This decision is taken inside the controller of the rails MVC framework and can be modified by the user. The user may wish not to respond to a particular type of request.
The distinction is made by suffix in URI, eg. ..../users/123.json. And You do it by yourself in controller.

Getting the current browser url in Grails

I need to get the browser URL in Grails, or particularly, a parameter off of it in the UrlMapping.
I need this in a particular circumstance, after an asynchronous call from a different controller/action, at this point, request.forwardURI has changed to the asynchronous url, while the actual browser url has remained the same.
Is there a simple way to do this?
If you have access to the request object, you can get any property of the URL (including parameters), because request is an implementation of HttpServletRequest.
Since you're doing an asynchronous call, just add the current browser URL as a parameter to your request. Retrieve it via window.location and add it to the params passed in via your async call.
If you are trying to keep track of the current state your user is in based on URL parameters you might look into Spring Web Flow support within Grails -> http://grails.org/doc/latest/guide/theWebLayer.html#webflow
Obviously this is more for stateful web apps than RIA stuff with Ajax but Web Flow does a very good job at isolating particular user operations and might help here as well.

Is it secure to POST Credit Card data from View to Controller?

Need to submit some CC data from the View to the Controller where it will be processed, can I just POST it or is there some common way of securing the data in transit?
Post the data using SSL.
Here's a good resource on setting up SSL with IIS and ASP.NET.
Posting with SSL like Rex M mentioned is definitely the first step. You should probably make the page where they are typing their credit card number SSL as well. This will give your users the green URL of comfort.
You should also include protection against CSRF attacks. Use the anti-forgery token.
Also, you should use the PRG (Post, Redirect, Get) pattern to make sure that the credit card numbers aren't submitted twice. After the post, don't just render a different view, send a redirect so their browser does a GET against another URL - probably your confirmation page.
You'll run into a few ASP.NET MVC specific things:
If you have some http pages and some https pages, how will you code the links to the https pages from the http pages. You can hard code them, but you'll have to hard code the domain and protocol. You can't just use <%= Html.ActionLink(... see this SO question for more details.
You'll want to make sure you can't hit your controllers when you are not using SSL. This will help you catch any errors, and ensure that no one uses http instead of https. See the [RequireSsl] attribute in the futures assembly. Here's a blog post about it from Adam Salvo
I haven't read about the implementation of the ASP.net-MVC. However, i believe that you have mixed up the terminology.
The MVC Pattern would be evaluated on the server end. [So there is little need to do security checks between the components (unless they are exposed outside the program)]
I believe that many people get the impression that you are talking about HTTP POSTS after a form submission (as opposed to HTTP GETs)

Grails forwarding and/or redirection with parameters

Is it possible to do page forwarding in Grails? I searched but no luck. If possible, how do I pass parameters in the forwarding method? If not, how would I do it using redirection? I've found something like this for redirection so far:
Redirection is idiomatically done in a controller in Grails. See the
redirect method in the Grails User Guide
An example using parameters:
redirect(action:"show",id:4, params:[author:"Stephen King"])
You might also be able to accomplish a forward equivalent through the URL Mapping mechanism, including adding one or more parameters.

Resources