How to redirect to a page based on a condition in Microsoft Power apps? - crm

I am new to Powerapps portal. I have a situation where I need to redirect the user whenever a condition is false.
For example: I need to check whether every user is given consent, if YES then go to the page they need if NO, then redirect to the ~/consent page. For this, I have a flag in liquid code like {{ user.consent }}
I am not sure how can I do this. I tried adding this condition using JAVASCRIPT in the Header as it is global and used in the whole application. But, the redirect takes a longer time.
I wanna know if Microsoft offers any easy way to do this? I see there is a section in Powerapps Portal Management for Redirects. Can I add a condition there? Like below image:
I know I need to produce some reproducible steps or code here. But, I am completely new to this Powerapps. Any posts or articles will be helpful.

Related

How to add a bespoke social sharing message to a specific page

I've used services like 'Add This' for a while but now I need to add a couple of specific bits of functionality to an ecommerce order completion page. It's to work like Amazon's order thank you page where it allows you to post a message to Facebook saying something like 'I just bought a widget on Amazon'.
Equally I'm looking for the equivalent in Twitter.
I've added a bunch of OG tags and share buttons but can't get it to do what I need. From further reading it sounds like I might need to create a Facebook app of some sort and use FB ui to create the link to post to the user's wall. I was hoping to do this without getting tangled up in that level of permissions etc but maybe that's not possible any more?
This is being developed on asp.net C#, in case there's a library that I haven't found in my searching.
Can anyone familiar with this type of development point me in the right direction?
For Twitter, the simplest way is to use Web Intents.
For example, if you want to share the text
I love http://example.com
URL encode the text to I%20love%20http%3A%2F%2Fexample.com and use the Twitter Web Intent URI. E.g.
https://twitter.com/intent/tweet?text=I%20love%20http%3A%2F%2Fexample.com
When the user clicks on that link (try it!) or is directed there by your service, they'll be prompted to share that text.

Is it possible to provide an url with a POST instruction in a web-link?

Is it possible to provide an URL with a POST instruction in a web-link?
I'm trying to link to a page that requires the user to select an option from the drop-down, and looking at the source of the page, it appears to POST the selection.
<form method="POST">
<select name="roomname">
<option value="+Community">+Community</option>
<option value="2011 Graduates">2011 Graduates</option>
...
</select>
I'd like to provide the user with a link to get to the page that preselects the correct option for the user without modifying the system I'm trying to send them to.
Is that possible to do with just an URL? If so, how would one do that?
(I'm pretty sure the system is running Python, not PHP, on the backend.)
I've never seen this as being possible, because this would allow all sorts of cross site security issues.
e.g. a POST usually signifies some user action and you don't want it to be an automated action like a GET - i.e. a GET can be done automatically like on images that are requested without the users permissions when viewing a webpage or email.
Having something that is expected to be user initiated like a POST happening automatically would be a nightmare to maintain.
You can't do that with POST. You can do accomplish this using javascript or the server side language of your choice.
No, it is not possible to perform a POST request with a URL link. Such links always perform a GET request instead.
The only way to do what you are asking for is to make the link invoke client-side scripting that navigates to the desired URL and then manipulates the desired <form> fields on the new page. Since you would be navigating to another URL, your script will have to run from a different window/frame then the one that is being navigated.
Yeah, it looks like it's not provided for in URL specification:
http://www.ietf.org/rfc/rfc2396.txt
Thanks for the feedback. I'll leave this up in case anyone else has this type of question in the future.

How do I make a beta access page like the one on superuser.com?

I'm working with ASP.Net MVC and I would like to make a web site accesible via the internet, but only to a select few people right now. I want to do something basically exactly like the beta access page with password just like they did on stackoverflow, serverfault, and superuser.
I don't just want to check and redirect in the home controller, I want it to always go there no matter what url is used.
Anyone know how they do it?
I don't know enough about MVC in particular, but it would probably mean creating a base controller and overriding OnActionExecuting or OnAuthorization.
I'd create a custom filter that extended AuthorizeAttribute. That way you can put it on the controllers/actions you wanted, and remove it easily enough. Since it's essentially a decorator, you would be playing nice with the Open/Closed principle too.
If you override AuthorizeCore you can check session/cookie/whatever for the login and if that passes, run the base AuthorizeCore too.
The easy way is to put something in the users session. Run a check either on the master page or in an http handler to see if this session is correct or not. If not redirect to the password capture page. When the password is provided then set the session variable...wa la they are in.
If you want to remember them then also drop a cookie and add that to your check as well.

Smart way to disallow users going to a site page directly

A site has 100's of pages, following a certain sitemap. A user can navigate to page2.aspx from page1.aspx. But if the user goes to page2.aspx directly say through a book marked URL, the user should be redirected to page1.aspx.
Edit: I dont want to go in and add code to every page that needs to fulfill this need.
Note: This is not a cross-page postback scenario.
You might consider something that is based off WorkFlow, such as this: http://blogs.msdn.com/mwinkle/archive/2007/06/07/introducing-the-pageflow-sample.aspx
The WCSF team also included a pageflow application block that you can use as a standalone add-on to your application.
I guess you could check the referrer, and if there isn't one / or it isn't page1.aspx then you could redirect back to page1.aspx.
As another answerer mentioned, you could use the Referrer header, but that can be faked by the client.
Since you don't want to modify each page, you could do something with an IHttpModule. Assuming you have some way of describing the valid page navigations, you could do something like this in the BeginRequest handler:
Check the session for a list of valid pages (using a default list for first visit if none are in the session).
If this request is for an invalid page, redirect to the place the user should be.
Based on this request, set up the list of valid pages and redirect page in the session so it's ready for the next request.
I recently worked with real code that checked to see if referrer was blank and used that as a step in authorization. The idea was users wouldn't be able to fake a referrer, you don't need a custom browser to fake a referrer. Users can book mark your page to delicious, then delicious.com is the referrer (and not blank).
I've had real arguments about how sophisticated a user needs to be to do certain hacks-- i.e. if users don't know how to set the referrer, then you can trust it. While true, it's unlikely your users will write a custom browser, but there already are Firefox addons to set headers, referrers etc and they're easy to use.
Josh has the best answer-- on page2 you should check the page hit log and see if the user has recently visted page1
I like alot of the answers above (specifically the workflow).
Another option, is creating each page as a usercontrol and having page1.aspx control what usercontrol gets loaded. This has the advantage of storing your workflow in a single place instead of on each page.
However, I don't think there's a magic bullet out there. It sounds like this security problem is an afterthought, or possibly reported as a bug, and you have been tasked with fixing it quickly and efficiently.
I would start weighing the answers here with their associated cost in hours.. I suspect the quickest solution will be to check referrer addresses on each page. Although hackable, it is obscure and if that risk is acceptable to you it may be the appropriate solution.

re-rendering a site within an iframe?

I want to make a site where there user can basically navigate the web from within an iframe. The catch is that I'd like to be able to have more control over what is rendered within the iframe. Specifically,
I'd like to be able to filter out images or text, disable forms etc.
I'd also like to be able to gather feedback such as what links the users clicked on.
Question 1:
Is this even possible using a standard back-end scripting language (like php), with html and javascript on the frontend?
Question 2:
Would I first need to grab the source of the site before it is rendered, then do whatever manipulation is necessary, and finally re-render it somehow?
Question 3:
Could somebody please explain the programming flow that would occur here (assuming its possible)?
I think you would probably want to grab the source of the of site (with server-side code) before rendering it. You might run into cross-site scripting issues if you try to use JavaScript. Your iframe would load a page like render.php and pass the address of the page to render os a querystring parameter. Then use regular expressions to find elements in the HTML that render.php downloads from the address. Rewrite the HTML as necessary and then write it all out to the iframe.
Rewrite links so that that the user is taken to a page you control and redirected onto a target site if you want to track where people are going. Example: a link in the page needs to go to google.com. You would send them to tracker.php?target=http://google.com. You control tracker.php and can log each load of this page and then redirect the user to the target site.
Update:
Another possible solution is to use Apache or other server to proxy the target website. There are modules like mod_proxy for this. There may also be modules that let you parse the HTML or you could roll your own.
I should point out that even the best solutions offered to your question will be somewhat brittle if you do not have full control over the target site. You will want to have lots of error handling or alerting.
You can have a look at this. It uses iFrame really well, and maybe even use the library it has.

Resources