w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How to disable form authentication cookie in two mvc 4 web application
Make both applications rely on cookies of different names. To do this, edit the forms authentication sections of the web.config and set a value in one of your applications and a different value in another application: application1: <authentication mode="Forms"> <forms name="cookiename1" ... /> application2: <authentication mode="Forms"> <forms name="cookiename2" ... />

Categories : Asp Net Mvc

Can I disable a cookie from being sent automatically with server requests?
The sessionID is stored in a cookie already there's no need to manage it. Because the HTTP protocol is stateless the only way to maintain state is through a cookie. What happens when you set a session value the server will look up the dictionary of items associated with that cookie id (session Id). What is meant by stateless is that between requests HTTP does not know if your still alive or have closed your browser. Therefore with each request the browser will attach all cookie values to the request on the domain. SessionId is stored in the cookie automatically when they go to your site. The Server then uses that value to look up anything you've set in the users session. Depending on which programming language and/or server you're using the session could be handled differently but

Categories : Security

How to disable cookie handling with the Python requests library?
You're getting back "k2": "v2", "k1": "v1" because they're sent in GET params. If you follow up with a second request you'll see you send no cookies. Unless you use requests.Session cookies are not automatically handled in the client and you have to explicitly pass a dict or CookieJar with each request. In [17]: r = requests.get("http://httpbin.org/cookies/set?k1=v1&k2=v2") In [18]: r.content Out[18]: '{ "cookies": { "k2": "v2", "k1": "v1" } }' In [20]: r.cookies.get_dict() Out[20]: {} In [21]: r = requests.get("http://httpbin.org/cookies") In [22]: r.content Out[22]: '{ "cookies": {} }'

Categories : Python

How to disable JSESSIONID cookie-based (and any else) session-tracking features in jetty 9?
With servlet 3 it is possible to set session tracking mode as a part of servlet registration - ServletContext#setSessionTrackingModes... you can try that. However in your case I would investigate who is calling HttpServletRequest#getSession(...). Put breakpoint in this method to see who is calling it. Some piece of code in your application is initializing session.

Categories : Spring

Enable / disable cookie based login in Yii framework on login
You would use this if user checked the remember me checkbox: Yii::app()->user->login($identity, 24*3600*7); and this if he didn't: Yii::app()->user->login($identity, 0); Make sure that you allowed auto login in your config file: 'components' => array( 'user' => array( 'allowAutoLogin'=>true, ), // ... ),

Categories : PHP

How to use Rack middleware to simultaneously set cookie and send response with cookie in effect
you need to setup your middleware in your application.rb config.middleware.insert_before "ActionDispatch::Cookies", "GeoFilterMiddleware" and in your middleware do something like this: def call(env) status, headers, body = @app.call(env) if from_uk?(env) Rack::Utils.set_cookie_header!(headers, 'country', { :value => 'UK', :path => '/'}) end [status, headers, body] end

Categories : Ruby On Rails

What are the obvious vulnerabilities to using a session identifier cookie and a user_id cleartext cookie?
Well, you can always pass the User Id in cookie; however, another way to edit self is to allow "self" or "me" in the URIs to resolve to the sessions current user for example /users/me/profile/ instead of /users/42/profile/ - then however you need to make sure that no data is cached as it would be quite confusing for the users to see another users' profile data as their own. Actually in my latest project we used both of these approaches simultaneously.

Categories : Javascript

Update jquery cookie pb after addClass , some div shouldn't take class cookie created
have a look at var $qsts = $(".quest").show(); var $anrs = $(".ans").hide(); $('.quest').click(function(){ var $ans = $(this).next().toggle(10); $anrs.not($ans).hide(); }); $('.ans').change(function(){ var $ans = $(this).closest('.ans'); var $act = $ans.prev().toggleClass('question-active', $ans.find('input:checkbox:checked').length > 0) var items = JSON.parse($.cookie('question-active') || '[]'); var qstName = $act.get(0).className.match(/(questiond*)/)[1]; if($act.hasClass('question-active')){ if($.inArray(qstName, items) == -1){ items.push(qstName) } } else { items.splice($.inArray(qstName, items), 1) } $.cookie('question-active', JSON.stringify(items)) }); var items = JSON.parse($.cookie('question-act

Categories : Jquery

Set Cookie File Name
You can't decide what file name a cookie should have when it's saved, that's up to the browser. The only thing you can do with cookies is storing information in them and reading it later again.

Categories : Javascript

Adding cookie to HttpServletRequest and retrieving cookie from HttpServletResponse using Mockito
For the request: construct the array, adding any Cookies you want, then add the behaviour to the mock: final Cookies[] cookies = new Cookies[] { ... }; final HttpServletRequest request = mock(HttpServletRequest.class); given(request.getCookies()).thenReturn(cookies); ... pass to controller/servlet etc ... For the response you create the mock and then verify the addCookie call by either using an ArgumentCaptor to capture the actual cookie passed to addCookie: final ArgumentCapor<Cookie> captor = ArgumentCaptor.forClass(Cookie.class); verify(response).addCookie(captor.capture()); final List<Cookie> cookies = captor.getValue(); ... perform asserion on cookies ... Or build the expected cookie and verify: final Cookie expectedCookie = ... verify(response).addCookie(expe

Categories : Java

Loss of '+' characters when fetching cookie using perl's CGI::Cookie->fetch
Cookie values are url escaped, which means that spaces are replaced with the + character and other punctuation marks are replaced with %xx codes. The CGI::Cookie::fetch method decodes the value, and the spaces in your cookie value are restored. You can use the raw_fetch method if you don't want the cookie values to be decoded.

Categories : Perl

HttpWebRequest: Add Cookie to CookieContainer -> ArgumentException (Parametername: cookie.Domain)
CookieContainers can hold multiple cookies for different websites, therefor a label (the Domain) has to be provided to bind each cookie to each website. The Domain can be set when instantiating the individual cookies like so: Cookie chocolateChip = new Cookie("CookieName", "CookieValue") { Domain = "DomainName" }; An easy way to grab the domain to is to make a Uri (if you aren't using one already) that contains your target url and set the cookie's domain using the Uri.Host property. CookieContainer gaCookies = new CookieContainer(); Uri target = new Uri("http://www.google.com/"); gaCookies.Add(new Cookie("__utmc", "#########") { Domain = target.Host });

Categories : C#

jQuery: remove a cookie when closing the browser (session cookie)
There is some code that worked for me. It should expire when you close the browser because of the date to expire being before now: var vEnd = new Date(); vEnd.setDate(vEnd.getDate() - 1); var endOfCookieText = "; expires=" + vEnd.toGMTString() + "; path=/"; document.cookie = escape('testCookie') + "=" + escape("eat cookies") + endOfCookieText; FIDDLE MODIFIED Note that the fiddle gives a bunch of load errors on the console for me.

Categories : Javascript

SessionAuthenticationModule Cookie Handler not creating HttpOnly secure cookie
I am using the same implementation and do not see your issue using Fiddler2. However maybe the issue is related to your debugging tool? In IE10 debugging tools the secure and http only flags are only displayed when the cookies are first received. If you check using Chrome debugging tools you should see the flags displayed correctly on all requests.

Categories : Asp Net Mvc

Cookie Code not removing opened element of cookie
Fixed it by using $.map and .join() var openClose = $('.openClose'); openClose.on('click', function() { var cook = ReadCookie('slideHide'), miniParent = $(this).parent().parent().parent().children('.main-content'), miniDisp = miniParent.css('display'); if (miniDisp ==="block") { KillCookie('slideHide'); $(this).parent().parent().parent().children('.main-content').slideUp(); var slide = cook+","+ "#"+$(this).parent().parent().parent().attr("id"); SetCookie('slideHide', slide, 100); } else { $(this).parent().parent().parent().children('.main-content').slideDown(); KillCookie('slideHide'); var newCookie=[], a= $('.module').children('.main-content').filter(":hidden"), c = $.map(a,function(n,i){ return "#"+$(n).p

Categories : Javascript

Create new cookie or add new cookie if one exists using jquery/javascript (or php?)
Your Code seems little strange to me... And if you try it like this: $(document).ready(function() { $("#button").click(function() { if ($.cookie('cookie_1') == null) { $.cookie('cookie_1', $('#phrase_here').text(), {expires: 7}); } else { $.cookie('cookie_2', $('#phrase_here').text(), {expires: 7}); } }); });

Categories : Javascript

jQuery cookie plugin creates same cookie instead of read it
$.cookie is only read access if no other parameters (but the cookie's name) are supplied to the method [See the source] If you're interested in reading it, just supply $.cookie('UniqueID') and remove the second parameter. As an FYI, path (and other cookie properties) are only relevant when assigning a value, not retrieving. In other words, you don't need to supply path:'/' to get cookies that are applied to that path, document.cookie should natively perform that check.

Categories : C#

Does a persistent tracker cookie become a session cookie if I setMaxAge(-1)
setMaxAge public void setMaxAge(long expiry) Sets the maximum age of the cookie in seconds. A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age. A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted. Thank you all for your assistance.

Categories : Java

Check if a cookie exists NOT using the jQuery cookie plugin
create a function that returns null or false if the cookie doesn't exist : function getCookie(c_name) { var c_value = document.cookie, c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) c_start = c_value.indexOf(c_name + "="); if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start, c_end)); } return c_value; } var acookie = getCookie("cookiename"); if (!acookie) { alert("Cookie not found."); } FIDDLE

Categories : Jquery

how to know expiration time of ASP.NET_SessionId from cookie file in php?
Most sites won't send back a cookie with the expires date and will handle when to log you off server side. The reason for that would be that if it was grabbing when to log you out from the cookie you could easily modify it and never get logged out which wouldn't be very secure.

Categories : PHP

can't download cookie protected file with python
You could try to parse the response from the first code section and use the extracted url with the same opener. Without knowing the actual format of the link: import urllib, urllib2, cookielib, os import re # going to use this now! username = 'somebody' password = 'somepass' cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) login_data = urllib.urlencode({'username' : username, 'j_password' : password}) resp = opener.open('http://www.some.site/index.php', login_data) content = resp.read() print content match = re.search( r"<as+href="(?P<file_link>http://www.some.site/excel_file.php?t=d+)">", content, re.IGNORECASE ) assert match is not None, "Couldn't find the file link..." file_link = match.group('file_link') print "down

Categories : Python

PHP curl downloading cookie & javascript protected file
You can simply use file_get_contents('http://www.kse.com.pk/scripts/communicator.php?f=20130812.lis.Z&l=Hd') to grab the file, and write it on your disk. But it seems that your file passes by a script which need JS to be enabled.

Categories : Java

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

How can I use Android to download a session/cookie based file using webView?
I was dealing with the same problem and I managed to get your first solution working, only with a slight change. Just replace Set-Cookie width Cookie: request.addRequestHeader("Cookie", cookie); Btw. session based means that the auth data are not stored in cookies but on server side, identified by a key, which IS stored in cookies. So it actually doesn't matter whether it's session based or not, cookies are used in both cases. I've also tried the second solution (it's simpler) but from what I've read it seems that Browser.EXTRA_HEADERS is supported only by the default Android browser. So if the user has a different browser in his device it won't work. This is an old question but I hope it will help someone.

Categories : Android

Cookie duplicated in document.cookie
The problem was that I had earlier set a cookie with the jquery plugin, which sets the current path as that path for the cookie. The above .Net code sets the path of the added cookie to "/", so there was two different cookies present, which was invisible to me when viewing the document.cookies variable. My solution was to set the path of the jquery cookie to be "/".

Categories : Javascript

Creating a subdomain Auth cookie then redirecting to subdomain loses the cookie in asp.net MVC4
I have good news and bad news. The bad news is-- you can't do it. See here for an explanation. Essentially your server is setting a cookie for a domain it does not contain, so the cookie is rejected. The good news is-- you don't want to do this anyway. Your design violates OWASP 2013 A4 (unsecure and unvalidated direct object reference). In this case you are storing user's access permissions as the domain of the cookie, which a hacker can easily modify. Find a different way to designate subdomain access. There are all kinds of ways to do this. Here is one way that is pretty close to your plan: Store the subdomain in the cookie value itself. Create a secure document container that lists the subdomains to which the user is granted access. You could for example store the subdomain

Categories : Asp Net

Cookie Header in PhoneGap: Refused to set unsafe header "Cookie"
The short answer is no, you can't set the Cookie header. The reason for this is that Chrome is your User Agent, so it is required by the HTTP specification to disallow modifications to headers which have security implications. One solution would be to perform an action that allows the server to set the cookie on your XmlHttpRequest object. You say you're already trying to do this but it's not working. I suspect that's because you need to set withCredentials on your ajax request. Add the xhrFields attribute, as follows. var token; $.ajax({ url: "https://server.com/AuthService/api/account/login", crossDomain: true, xhrFields: {withCredentials: true}, type: 'post', async: false, data: { username: "username", password: "password" } }).done(func

Categories : Javascript

Disable Fast Web View on a PDF file
All valid linearized (Fast Web View) PDFs are also valid un-linearized PDFs, so it's hard to see why FPDF would complain - the worst it could do is produce an output file which is not linearized. Our cpdf tool can remove linearization easily: cpdf in.pdf -o out.pdf ought to do it.

Categories : PHP

How to disable file input if text field is used
Why don't you use the length proprety to see if the input is empty ? For example : $("#linkurl").on('keyup blur', function(e){ if($(this).val().length == 0){ $('#link').attr('disabled'); }else{ $('#link').removeAttr('disabled'); } });

Categories : Jquery

XDebug - Disable writing traces to file
xdebug.auto_trace is required for the auto prepend stuff. Try this( from the docs) xdebug.default_enable Type: boolean, Default value: 1 If this setting is 1, then stacktraces will be shown by default on an error event. You can disable showing stacktraces from your code with xdebug_disable(). As this is one of the basic functions of Xdebug, it is advisable to leave this setting set to 1.

Categories : PHP

How to disable a pep8 error in a specific file?
As far as I know, you can't. You can disable errors or warnings user wide, or per project. See the documentation. Update Instead, you can use the # noqa commant at the end of a line, to skip that particular line (see patch 136). Of course, that would skip all PEP8 errors. The main author argues against source file noise, so the suggested # pep8 comments did not get included.

Categories : Misc

Disable submit button when file is not selected
Try with Jquery declared because the Jquery is not included: <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.0.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript"> $(document).ready( function(){ $('input:submit').attr('disabled',true); $('input:file').change( function(){ if ($(this).val()){ $('input:submit').removeAttr('disabled'); } else { $('input:submit').attr('disabled',true); } }); }); </script>

Categories : Javascript

Disable Javascript from cross-domain file
Might not be the best solution, but since you can't control the returning data - You can load only some of the HTML, e.g. only the elements that interest you: $('#some-id').load('http://www.some-url.com/index.html div#elementId'); Also, like apsillers mentioned, you can exclude the script: $('#some-id').load('http://www.some-url.com/index.html :not(script)'); Or, you could remove it at return level: $.get('http://www.some-url.com/index.html', function(data) { $(data).find('script').remove(); $('#some-id').html(data); });

Categories : Javascript

Cookie being set, or not set.? Cookie Set to Array()
You don't say if this is what you're doing, but -- If you set the cookie and try to read the cookie during the same execution of the script, the $_COOKIE array will not yet be populated by the cookie. You won't see it till the next time the browser sends a request to the script.

Categories : PHP

Disable manual editing of application.exe.config file
there are ways to encrypt sections of the app.config file so that if opened with a text editor it won't be possible to read its content, would that help? see the discussion here for some links further down.... Encrypting the app.config file or you can also decrypt the appSettings or other settings from your code and generate encrypted settings at compile time. It depends on how often and how you plan to edit those settings. sure there are also other ways and possibly also file access security methods but it depends on your network as well, if you want to exclude a group of people from editing that file in your domain, you could give them only read access but what happens if they copy the whole application folder to another location and edit the config file in the new location?

Categories : C#

How to disable a specific javascript file in Web Browser control in C#
There's a great article on this at javascriptKit.com Dynamically removing an external JavaScript or CSS file: To remove an external JavaScript or CSS file from a page, the key is to hunt them down first by traversing the DOM, then call DOM's removeChild() method to do the hit job. A generic approach is to identify an external file to remove based on its file name, though there are certainly other approaches, such as by CSS class name. With that in mind, the below function removes any external JavaScript or CSS file based on the file name entered: function removejscssfile(filename, filetype){ var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from var targetattr=(filetype=="js")? "src" : (filetype=="css")? "hre

Categories : C#

Emacs: disable automatic file search in ido mode
I found an easy solution: (setq ido-auto-merge-delay-time 9) The time here is in seconds. I could set a very large number to completely disable this feature.

Categories : Emacs

Powershell - disable parts of Open File Dialog Box
OK, per the comments, this modified version of your script disables access to create folders within the target directory whilst the dialog is active then removes the block at the end before the function completes: Function Get-FileName($initialDirectory) { <#DENY CreateDirectories privilege to currently logged on security principal#> $acl = get-acl $initialDirectory $right = "CreateDirectories" $principal = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name $denyrule = New-Object System.Security.AccessControl.FileSystemAccessRule($principal,$right,"DENY") $acl.AddAccessRule($denyrule) set-acl $initialDirectory $acl [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null $OpenFileDialog = New-Object System.Windows.

Categories : Dotnet

SpringDataRest and show welcome-file-list/disable link discovery
I've faced the same issue, and solved it like following : 1) Switched to spring-data-rest-webmvc 1.1.0.M1 2) Split your context configuration to web-config and rest-config WebConfig.java @Configuration @EnableHypermediaSupport @EnableSpringDataWebSupport @EnableWebMvc @ComponentScan(basePackages = {"com.yourcompanyname.XXX"}) public class WebConfig extends WebMvcConfigurationSupport { @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass( JstlView.class ); viewResolver.setPrefix( "/WEB-INF/views/" ); viewResolver.setSuffix( ".jsp" ); return viewResolver; } @Bean public ReloadableResourceBundleMessageSource messageSource() { ReloadableResourceBundleMes

Categories : Java

Batch File to disable internet options proxy server
It's in the registry, under [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings] you can either use the REG command in your BAT, or prepare a couple of .REG files, to automate the changes. for example, to disable Proxy, try REG ADD "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

Categories : Windows



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