w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can't redirect users to log in page when attempting to access a members only page
Turns out I was on the right track. All I needed to do was modify the authentication module from: <authentication mode="Forms"> <forms name=".ASPXFORMSAUTH" loginUrl="~/Account/Login" defaultUrl="~/" /> </authentication> to: <authentication mode="Forms"> <forms name=".ASPXFORMSAUTH" loginUrl="~/Account/Login.aspx" defaultUrl="~/" /> </authentication> The simple mistakes get me every time.

Categories : Asp Net

How can i set different custom login redirect for different types of users?
You need to create your own module which basically extends base class Mage_Customer_AccountController of Magento and overrides _loginPostRedirect function. A complete example can be found here: Redirect Customer After Login in Magento Now within that above method of _loginPostRedirect, you can get Customer group using following code: if(Mage::getSingleton('customer/session')->isLoggedIn()){ // Get group Id $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get customer Group name $group = Mage::getModel('customer/group')->load($groupId); //echo $group->getCode(); // You got the group code, do the redirection } Above code for getting customer group is acquired from Showing which group a customer belongs to in Magento

Categories : PHP

How to redirect users to their own profile page?
$_SERVER['PHP_SELF'] contains the filename of the currently executing script, so your condition will always match. I would use something like: if ( empty($_GET['id') && !empty($_SESSION['id']) )

Categories : PHP

Redirect first-time users to landing page
You could use javascript for this. Make sure that you have jQuery included. Add the following to your global javascript file that's included on both pages as we'll be using these helper functions on both the homepage and the landing page to check if the cookie exists and also to create it. <script> function create_cookie(name, value, days) { var expires = ""; if (days) { var date = new Date(); date.setTime( date.getTime() + (days*24*60*60*1000) ); expires = "; expires=" + date.toGMTString(); } document.cookie = name + "=" + value + expires + "; path=/"; } function get_cookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt

Categories : Wordpress

Drupal 6 - Redirect Anonymous Users to Login Page
Hope the following links could help u.. :) https://drupal.org/node/300607 http://drupal.stackexchange.com/questions/51523/content-access-module-hiding-menu-links

Categories : Drupal

play framework, redirect block users to some page
Add a isBanned property set to true for banned users and redirect accordingly. public class Application extends Controller { @Before static void preAction() { if(connectedUser().isBanned){ banned(); } } public static void banned() { String title = "You have been naughty"; render(title); } } And have all your controlled use the @With annotation @With(Application.class) public class MyControllerextends Controller {

Categories : Security

how to redirect loggedin in users from viewing login page in django, using generic views
I would override dispatch method: class LoginView(generic.edit.FormView): def dispatch(self, request, *args, **kwargs): if request.user.is_authenticated(): return HttpRedirect('/whatever/') else: return super(LoginView, self).dispatch(request, *args, **kwargs)

Categories : Python

How to redirect my Windows Phone C# app to a setting page?
You can use LaunchUriAsync to open up built-in apps. Use following code to achieve your requirement: Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:")); The problems: There are only limited uri schemes available. Here is a List and it's only available on Windows Phone 8

Categories : C#

redirect to custom not found jsp page
1) to handle 404 errors you need to setup 404 handler in web.xml 2) you got 500 err, cause probably something is wrong about your jsp page, you need to check jsp code carefully 3) the way you use pico is an antipattern, check pico docs

Categories : Java

Redirect page after changing UriMapper in Windows Phone 8
I see a couple of issues. First, you are not changing the mapping in your tutorial page so basically MainPage.xaml still maps to TutorialPage.xaml. Second issue is even after fixing that, navigation to MainPage.xaml will still not work because despite the actual page being TutorialPage.xaml, RootFrame.CurrentSource will still point to MainPage.xaml no matter what. To fix this you need to do the following in your tutorial page's button click // Inside the Button click event of TutorialPage.xaml // Change the mapping so that MainPage points to itself ((UriMapper)App.RootFrame.UriMapper).UriMappings[0].MappedUri = new Uri("/MainPage.xaml", UriKind.Relative); // Since RootFrame.CurrentSource is still set to MainPage, you need to pass // some dummy query string to force the navigati

Categories : C#

wp custom login page - redirect not working
Once the user is logged in the session is instantiated and you should be able to forward the user wherever you like. <?php if ( ! is_user_logged_in() ) { // Display WordPress login form: $args = array( 'redirect' => home_url(), 'form_id' => 'loginform-custom', 'label_username' => __( 'what is your name?' ), 'label_password' => __( 'what is your password?' ), 'label_remember' => __(''), 'label_log_in' => __( 'Log In' ), 'remember' => true ); wp_login_form( $args ); } else { // If logged in: header('Location: /'); ## / redirects to root domain lvl } ?>

Categories : Wordpress

Unable to redirect to particular page when click on toast notification in windows phone 8 app
Since you're using Fast App Resume you'll want to read through http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj735579(v=vs.105).aspx and even play with the sample code right at the end of that article. You should be getting a Navigated event which you can handle to refresh your content / redirect to the right place. If it isn't working for you and you aren't cancelling any in-progress navigations during app resume then there may be an edge case bug that you're hitting.

Categories : Windows Phone 8

Combine users from database to authorization role
You need a RoleProvider for that. There's a default SqlRoleProvider that you could use and which would allow you to assign roles to your users.

Categories : Asp Net Mvc

Redirect to custom 404 error page with .htaccess when the site url is unknown
You can just use a proceeding slash and not declare the URL at all. For example: ErrorDocument 400 /error-404 This will always grab the page from http://domain.com/error-404, although the URL will remain as whatever the 404ing URL is they're trying to access. The only thing you need to be sure of is that your 404 page is in the domain root!

Categories : Htaccess

How to handle role authorization for users having multiple roles in ASP.NET MVC?
I would provide you this resolution: Data Base Users ([PK]Id, Name, etc.) Roles ([PK]Id, Name, Description, etc.) UserRoles ([PK]UserId, [PK] RoleId) Users table stores information about users, like their names, emails, etc. Roles stores information about rolesm like its name, description, etc. UserRoles is just look-up table which you can use to tie specific user to specific role. Code in order to let your code work with this tables you can add your custom role provider, where will be enough overload 2 methods public override string[] GetRolesForUser(string username) and public override bool IsUserInRole(string username, string roleName). Usage When you'll complete you simply can use Authorize attributes [Authorize(Roles = "Administrators")] to check if user has aceess to

Categories : Asp Net Mvc

Beforeunload is not working to redirect user to another page, how can I redirect user to another page/url when he attempts to close a window/tab?
*Don't do it* But it is possible with the user's permission; you can achieve something like this (took me a while to find a website that was happy in a frame) window.onbeforeunload = function () { window.setTimeout(function () { // escape function context window.location = 'http://bbc.co.uk'; }, 0); window.onbeforeunload = null; // necessary to prevent infinite loop // that kills your browser return 'Press "Stay On Page" to go to BBC website!'; // pressing leave will still leave, but the GET may be fired first anyway } Demo

Categories : Javascript

Adding a custom "page" to the Windows 7 control panel. No new application window
What you're seeing here is Windows itself, not some random app. It is there because Microsoft hardcoded a link to this page in a Microsoft product. To be more precise, you see here Explorer.Exe (which contains the control panel) showing settings for the desktop background (which is also Explorer.Exe).

Categories : C#

Windows Azure Active Directory Single Sign On - Custom error page for log in errors
Totally possible. ACS gives you error messages in encodeed JSON like this {"context":null,"httpReturnCode":401,"identityProvider":"Google","timeStamp":"2010-12-17 21:01:36Z","traceId":"16bba464-03b9-48c6-a248-9d16747b1515","errors":[{"errorCode":"ACS30000","errorMessage":"There was an error processing an OpenID sign-in response."},{"errorCode":"ACS50019","errorMessage":"Sign-in was canceled by the user."}]} First you need to enable the "Error URL feature" in management portal, for your ACS namespace-> Edit Relying party-> Error URL. You need a helper classes to decode the JSON. steps here Configure anon access to them Error page. With this you are in full control of the page, you can show the error message the way want and brand the page to match the look and feel of your relying

Categories : Asp Net Mvc

How to redirect /page/index page to /page (and /page to /page/) in Ruby on Rails?
If you don't want to cause a full reload of the page, then you should not use "redirect" in your routes, as that simply issues a browser redirect. That would cause Rails to issue a 301 "Moved Permanently". That essentially means "there is a /page/index route but it's a mistake, we don't use it anymore, please go to /page instead and never come back here." If that is the case then that is what you want to do. If you're using Passenger and will continue to use Passenger, it would be more efficient to put an Apache redirect rule in the htaccess file. It also seems strange that this is even an issue. How have /page/index, /page, and /page/ emerged in the wild as URLs that all point to the same index#index action? What is this index controller? The usual thing is to have, say, a PagesControlle

Categories : Ruby On Rails

Custom authorization based on url in ASP.NET MVC
Remove the virtual path before checking it: var relativePath = yourPath.Remove(0, HttpContext.Current.Request.ApplicationPath.Length); Works both for virtual dirs and domains.

Categories : C#

Creating Custom Authorization Attribute with MVC
It appears that the name of the property you are using in the call to the attribute in your controller is different from what is specified in the AuthorizeUser class. Change the property AccessLevel to be Permission. Like this: public class AuthorizeUser : AuthorizeAttribute { public string Permission { get; set; } protected override bool AuthorizeCore(HttpContextBase httpContext) { The call in your controller will set the property value: [AuthorizeUser(Permission = "Browse")] public ViewResult Index()

Categories : Asp Net Mvc

authorization username and password from sql server in windows authentication
Window Authentication Functionality to a C# Desktop Application http://code.msdn.microsoft.com/Add-Window-Authentication-833ba913

Categories : C#

Redirect an URL by default, and show the original page when ?redirect=false is shown
Well... you actually need to test for that query parameter. something like: if ((Request.QueryString["redirect"] == null) || (Request.QueryString["redirect"] != 'false')) Response.Redirect("NEW URL"); } base.OnLoad(e); The test for null is there in case the redirect parameter wasn't passed in.

Categories : Asp Net

Why is a "redirect" (that is, `return "redirect:/myPage"`) not working for my Tiles page definition?
Thanks to hints left by Sotirios' comments, I discovered that my inability to "redirect" to "myPage" had nothing whatever to do with Tiles. Rather, after a harder look, I realized that it was the configuration of the controller associated with "myPage". I had to add the following "public ModelAndView myPage(HttpSession session)" method to the Controller (see snippet, below), in order to perform a successful redirect (i.e., from another controller)...i.e., using return new ModelAndView("redirect:/myPage"); The problem was that the "myPage" controller did not contain an "public ModelAndView myPage(HttpSession session)" method...(thanks again, Sotirius). Below, is the "public ModelAndView myPage(HttpSession session)" method - code snippet) @Controller @Scope("session") @

Categories : Java

how to redirect other users asp.net mvc 3
Seems like you need some COMET/push technology. You may take a look at SignalR which would allow you to push contents to specified clients. Basically all clients will subscribe to notifications from the server and when a particular request comes from an administrator you could then send notification to the selected clients.

Categories : Asp Net Mvc

Zend Server Windows - Authorization header is not passed to PHP script
I found that I can work around this by adding the following to the apache config on Windows: SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 This adds a HTTP_AUTHORIZATION key to the $_SERVER global, just as if the Authorization header had been passed through by Apache.

Categories : PHP

Sina Weibo Authorization page
The correct login flow consists of the following: 1. redirect user to the authorize page with the app's client id 2. client logs in to weibo (authentication) 3. client grants the application requested permissions (authorization) 4. client is redirected to your app page. I believe the step you are asking about is #3. Once a user has granted your application permissions, this will be stored on their weibo account. The user will no longer be prompted to grant permissions every time the user logs in. The exception is when the user has removed your application from their weibo account. Thus there is no way for your application to force the user to reauthorize your app every time. It is unclear under what circumstances this would ever be required/beneficial. As a side note: If a user is alread

Categories : Misc

Redirect unauthorized users asp net
You can use Response.Redirect or Server.Transfer Response.Redirect("AccessDenied.aspx"); Full example: protected void Application_EndRequest(Object sender, EventArgs e) { if (HttpContext.Current.Response.Status.StartsWith("401")) { HttpContext.Current.Response.ClearContent(); Response.Redirect("AccessDenied.aspx"); } }

Categories : C#

iis redirect all users except Bots
As seen in the comments, the problem had to do with case. Googlebot's name and useragent string both have the b in lowercase. The filter in the code looks for GoogleBot. Even though the OP set the filter to ignore case, it somehow didn't. So there.

Categories : Iis

nginX custom HTTP authorization , using scripts to decide
You can use the http_auth_request module. p.s. Do you actually know that nginx for windows is not production ready?

Categories : C

Custom Authorization using signalr PersistentConnection with websockets transport
Inside of PersistentConnection.AuthorizeRequest and PersistentConnection.OnConnected, you should access the User property of the IRequest object that is passed in as a parameter instead of the static HttpContext.Current.User property. This should work for all transports.

Categories : C#

asp.net authorization - deny all before login except the register page
This is happening because you are denying everyone from application by using <authorization> <deny users="?" /> </authorization> Above code will override all permission given to the folder Good idea would be Deny user folderwise and keep Register/Login/Help/Contact pages at root level.

Categories : Asp Net Mvc

Authentication and Authorization in single page applications
There is no difference between single and multi page applications in terms of authentication/authorization. If you are using Forms Authentication, Windows Authentication or yet another method of authentication/authorization, you still use it when moving to single page application architecture. In both cases, an application sends requests to the server to access resources. Multi page applications request pages. Single page applications request data from web services. Resources that need to be protected are protected, usually using built-in mechanisms. Suppose for example that your single page application calls webapi services at the server side to get json data, where requests are made with jquery/ajax. At the server side you guard service methods with the Authorize attribute or even vali

Categories : Asp Net Mvc

.htaccess Redirect all users to subfolder EXCEPT for IP
You can use a Skip flag [s]. Here is an example with multiple IPs. RewriteEngine on RewriteBase / RewriteCond %{REMOTE_ADDR} ^91.143.253.211$ [OR] RewriteCond %{REMOTE_ADDR} ^8.8.8.8$ RewriteRule .? - [S=1] RewriteCond %{REQUEST_URI} !^const [NC] RewriteRule ^(.*)$ /const/$1 [R=302,L] Note In the example before I had %{REQUEST_FILENAME}. This typically only works on server config files where the path to the filename itself is visible to the redirection script. Here I've changed it to %{REQUEST_URI} the part of the request that the browser can actually access.

Categories : HTML

how to redirect mobile and tablet users (both) to different url?
I think if you develope Your website as a responsive site then your problem will be automatically solve......... OR Get device width using following code and apply your URL DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int wwidth = displaymetrics.widthPixels; hope this will help you............

Categories : Jquery

Redirect non-javascript users when headers have been sent
Make use of <noscript> tag. Something like this <noscript> <meta http-equiv="refresh" content="0; url=http://example.com/somepage.html" /> </noscript>

Categories : PHP

Redirect users to www.url - $_SESSION issue
When the session cookie is set, it uses the current domain. But you can configure that this cookie should allow for wildcard domain "*.example.com" instead. That way the session would continue on either url. Be informed that wildcard domain cookies are a little bit unsafer, because they will be sent to ANY subdomain of "example.com" - even those subdomains that you created on some other server. This might not be an issue, but should be mentioned. But the real fix should be to only have ONE designated domain to be used. Redirect the user to this one domain with a permanent redirect code. That also circumvents the duplicate content issue of search engines (which is not a penalty, but rather the question of "Which of the two URLs should be shown as a search result?").

Categories : PHP

How to pass authorization value from cookie file and custom headers to getjson?
Try this to set the header: $.ajax({ url: 'http://something.com/ajax', type: 'GET', dataType: "json", success: displayAll, headers : { 'ASP.NET_SessionId': 'rtretretertret43545435454' } }); Don't forget to add the comma after 'displayAll' as its missing in your question.

Categories : Javascript

Scriptlets in a JSP Page to Access an Authorization Framework Using Enums
You could use EL for this. The way to do this is by first importing the core tag library, by putting this in the head of your jsp view. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Put your subject + permission(s) for that user in a hashmap, and make a function hasPermission, that returns whether or not the user has the permission. class User { private HashMap<String, List<String>> permissionMap; public boolean hasPermission(String subject, String action) { return permissionMap.getValue(subject).contains(action); } } In your servlet, you have to put the user object in an attribute of the request by using request.setAttribute("user", userObject); Afterwards, you can access them like this in your view. <c:choose&

Categories : Jsp

Develop a custom authentication and authorization system in consistence with web form application
If you hand-roll your own authentication, the security can only be the as strong as how you store Ticket in client side cookie securely. Normally, you want to encrypt the auth ticket/token and access via SSL. As long as you store the cookie securely at client side, it should not be an issue. I also would like to suggest to take a look at how ASP.Net creates Form Authentication Ticket. Note: If you use ASP.Net Form Authentication Ticket you do not need to store ticket/token in database, because user will send the auth ticket to server on every page request. var now = DateTime.UtcNow.ToLocalTime(); var ticket = new FormsAuthenticationTicket( 1, /*version*/ MemberID, now, now.Add(FormsAuthentication.Timeout),

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.