I have an app that reads a jpg file and displays the embedded GPS location on a google map using a TChromiumWindow.CreateBrowser component. (Delphi Berlin and CEF4Delphi latest version). Every time I run it I have to accept or deny cookies.
How do I make it remember my cookie choice ?
I have tried setting up a ICefCookieManager cookie manager but there is no option to set a cookie store and the cache folder remains empty. Also looked at a number of GlobalCefApp ideas I found on the internet without success.
The cookies are saved with the cache files.
Set the cache directory in GlobalCEFApp.Cache before the GlobalCEFApp.StartMainProcess call in the DPR file like this :
GlobalCEFApp.Cache := 'c:\my_custom_cache_directory';
Make sure that the windows user executing your application has write privileges in the cache directory.
With this setting you will only have to deal with the "accept or deny cookies" dialog the first time you visit a web page or when the cookies expire.
Related
Whenever I navigate to maps.google.com via my dcef3 instance (TChromium), the "welcome" bit always appears over the top. Can I turn this off somehow with some setting? If I go to maps.google.com in Chrome or Firefox, it doesn't appear.
I thought it may have been something to do with cookies maybe, so tried setting CefPersistSessionCookies to true but no luck. Maybe I need to set an Option property with TChromium or handle some other event? I have made no other changes to the default values for TChromium.
It seems I needed to have a cache_path set (CefCache). According to doco:
cache_path The location where cache data will be stored on disk. If
empty an in-memory cache will be used for some features and a
temporary disk cache will be used for others. HTML5 databases such as
localStorage will only persist across sessions if a cache path is
specified.
So it seems (almost obviously to me now) that cache is needed.
First of all, thank you all for taking time to read the question.
I am embedding Microsoft WebBrowser ActiveX control into my application. Normally such a WebBrowser instance saves cookies and caches to the system default location C:\Users\${foo}\AppData\Roaming\Microsoft\Windows\Cookies.
I want to store cookies in another directory. SFAIK that WebBrowser control uses WinINet to access caches and cookies. I think I should call InternetSetOption with a proper option flag. Can anybody shed some light on it?
WinInet does not give you the option of programmably changing the paths of its storage folders. The location of the Cookies and Cache folders are part of the calling user's profile instead.
Specifically, they are determined by the CSIDL_COOKIES and CSIDL_INTERNET_CACHE shell folders (FOLDERID_Cookies and FOLDERID_InternetCache on Vista+), which are configured in the following Registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
I have a web app where the administrator can create news, pdf documents and other stuff in his cms panel.
The problem is when the admin delete a new or something else the app deletes all the files related to that new, I mean the images, pdfs and other documents. Tha main problem is those files are stored in folders under the "news" folder and when the app deletes them the session is lost.
How can I do to have a file system without losing the session?
I'd like that file system within the app folder...
Impossible for us to store those folders outside the app and we don't want to use StateServer because of the performanne....
Any other solution?
Thanks
Your session is lost becasue IIS recompiles. The easiest solution in my opinion is to store your files outside the wwwroot.
Discussed on SO: ASP.NET restarts when a folder is created, renamed or deleted
[Update]
Example:
Let's stay your app is in c:\inetpub\wwwoot\virtualdir1
You make a work directory:
c:\inetpub\inetwork
Give the proper rights (read/write/etc) to the Asp.net user of your app pool and it should all work like a charm.
More info on setting the rights: What are all the user accounts for IIS/ASP.NET and how do they differ?
Store the path to the workdirectory in your web.config (you no not want to hardcode it)
Having those files within the app folder is a poor desgin. The session is probably lost as you are causing IIS to recycle due to the file system changes. It is much safer to not have your web application able to write to its own folder, doing so is a security risk.
Separate your document folder and web site folder. And give right permission your document folder.
I am working on an internal application. We have a website that displays all our SSRS reports for a group of work. I have been asked to see if I can link all the files (pdf, word, excel) for the group of work. These files are stored on a file server that users viewing the reports have access to. Each group has its own group of reports and shared files.
Is it possible to open the files (without downloading them) from a webpage? Meaning that they file is opened from the file server? I don't want people to download a copy of the file.
I am pretty sure this can work with IE because sharepoint does it. However, other browsers may have an issue.
EDIT: What I would like is to have a web page with links to the files. When they click on a link (say for a word doc), word will open the file that resides on the file server. Without out a local copy downloaded from the network share.
EDIT2: Please note, I know what I am asking is probably not possible in all browsers. I am more or less just making sure. It seems possible in IE using activeX, but out side of that browsers do a good job at keeping processes inside a sandbox.
3 options. Remember this is for an internal website.
link to the share using file://. This will have the side affect of downloading the file to be viewed. As long as user clicks open every time it should not be a big deal.
Use JavaScript and activeX to open word (excel, reader, ect) passing in the file path as a command line arguments. This works only in IE and in win7 (probably vista) user will get a pop up asking if it is ok for the activeX control to run.
Create a new protocol. openfile://. This would be set up to run an application that is installed on the client machine which would open the file. Since it is internal, the application could be installed on the machines without issues. This also requires a registry change.
I haven't picked one as this change is still being looked into but i figure I would update this in case someone runs into something similar.
I have an ASP.NET MVC website that works in tandem with a Windows Service that processes file uploads. For easy maintenance of the site, I'd like the log file for the Windows Service to be accessible (to me, only) via the website, so that I can hit http://myserver/logs/myservice to view the contents of the log file. How can I do that?
At a guess, I could either have the service write its log file in a "Logs" folder at the top level of the site, or I could leave it where it is and set up a virtual directory to point to it. Which of these is better - or is there another, better way?
Wherever the file is stored, I can see that there's going to be another problem. I tried out the first option (Logs folder in my website), but when I try to access the file via HTTP I get an error:
The process cannot access the file 'foo' because it is being used by another process.
Now, I know from experience that my service keeps the file locked for writing while it's running, but that I can still open the file in Notepad to view the current contents. (I'm surprised that IIS insists on write access, if that's what's happening).
How can I get around that? Do I really have to write a handler to read the file and serve it to the browser myself? Or can I fix this with configuration or somesuch?
PS. I'm using IIS7 if that helps.
Unfortunately I'm afraid you'll have to write a handler that will open the file, and return it to the client.
I've written an IIS Manager extension that displays server log files, and what I've noticed that even the simple
System.IO.File.OpenRead("")
can still run in the same problem, and return the same error.. It was kind of confusing.
In the end I used
System.IO.File.Open("", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
and I could easily open the file while the server was writing logs to it :)
I think the virtual directory is an "okay" solution, if you add the directory (application) with READ ONLY rights + perhaps "BROWSE directory" too (so you can see the folder contents rendered by the IIS).
(But once you do that, you should consider that you also anonymous access to that folder - unless you enable authentication, so watch out for "secret" contents of the logfiles that you might expose? just a thought.)
Another approach, I prefer myself, is to make a MVC/ASP.NET page that does the lookup in the folder by normal code, so that you 100% can filter whatever data is shown in the HTML.
You can open the files as TextStream's and in Read Only mode.
If it's a problem to gain access to the logfolder, I would use the virtual directory with READ ONLY access and then program something that renders the logfiles as HTML on my screen and with my detail levels. Perhaps even add some sort of "login" first. But it all depends on your security levels and contents of logfiles.
is this meaningfull to you? if not, please explain more, as I've been through this thought a few times already for similar situations.