iTextSharp.text.Image.GetInstance changes Request.MapPath - vb.net

I've been stuck on this problem all night. I've looked everywhere and can't seem to find anything related to my exact problem. On our IIS server we have a page that creates a pdf. We put an image in the header of the created PDF. This had been working properly until last night when we updated some unrelated code on different pages. Now when we try to create the PDF we get an error that the image file doesn't exist. Here's the weird part, iTextSharp.text.Image.GetInstance is changing the path we send to it?
Here's the line of code
Dim oImage As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Request.MapPath("~/images/" & sLogo))
If we output the results of Request.MapPath("~/images/" & sLogo) we receive
E:\Inetpub\sitename\images\logo.jpg
When we place it in in the iTextShart.text.Image.GetInstance() function our path output changes to
C:\Windows\SysWOW64\inetsrv\images\defaultlogo.jpg
You can see the logo itself changes too, it should be noted that we do use DefaultLogo.jpg in the case that a client doesn't use their own logo but all the ones i'm testing with do. The path E:\Inetpub\sitename\images does exist and logo.jpg does exist.
Here's the weirdest part, if i change the path from images to image
IE: iTextSharp.text.Image.GetInstance(Request.MapPath("~/image/" & sLogo))
the output will be
E:\Inetpub\sitename\image\logo.jpg
So i have no idea why images doesn't resolve.
Any help is greatly appreciated, and if this answer has been posted before and i just can't find it i'm very sorry, and if you could point me to that i would appreciate that as well.

I figured out my issue, and it's sheer stupidity on my part. The page we call to create the pdf had bad security on it. Basically we were looking for a session variable that didn't exist and redirected that page to a session time out notice. Removed that session check and it's working now!

Related

Why Odoo 15 emails do not show images?

When I open an email sent from Odoo, it does not show any images:
If I inspect the link of the image, I see:
https://ci5.googleusercontent.com/proxy/qSpzzzb6JaHXBEBtLfInNbNx6mQNl7odluv4KBqJaH1ZtoWPvGde60Bsprd7wy0WY5-7xgiZ9PJtkKtwvNA=s0-d-e1-ft#http://myip:myport/logo.png?company=1
If I paste that link on a new tab, I get a 404. However, if I paste the substring:
http://myip:myport/logo.png?company=1
I see the main company logo.
I have only one database running in the instance. I am using the IP http://myip:myport to access Odoo so far. I have that IP http://myip:myport set in the parameter web.base.url. I also have web.base.url set to True and report.url set to http://127.0.0.1:myport, although I think both have nothing to do here.
I've googled about this problem for hours, but the solution is not very clear.
Does anyone know the solution to this problem or have any idea of what can be happening?

Get a bit of code after image url in browser

I'm changing background image on hover.
The code for image url looks like this:
background-image: url('../assets/img/project1.png');
But when I look in the Chrome inspector it looks like this:
background-image: url(/img/project1.9fba20d0.png);
So when I try to change image need that code (9fba20d0) for it to work.
Why dose '9fba20d0' appear? How do I remove it or get it without hardcoding it?
I actually haven't used Vue.js, but I'm sure the random string appended to end of filename is for "cache busting" purposes.
Basically, the string changes each time you build your application so the next time you request index.html from the server it will reference the new filename (with a different random string at the end). If there was no string, the browser would look locally to find the file, which may be an outdated version, if you've made changes since last rebuild.
I'd try and understand how Vue.js is creating your production "assets", i.e. all the images and other static files and see if you have some options to change the default behavior, if need be. Might have to read the documentation pertaining to caching.
Hope that at least points you in the right direction!

Partial view never affects site after upload and IIS reset

I'm including a partial view in one of the pages of my MVC4 site which when deployed, even after a restart of the web site and recycling of the app pool, never seems to affect the site
I'm wondering if this is caching coming into play
I ended up including the content of the partial view in the page iteself and that seems to have worked but I'd rather have the partial view as I'd like to use the view in other parts of the site
The question is, does anyone have any suggestions as to why this might be happening? I've been pulling my hair out trying to get a view to post the correct data, only to realise that some of the hidden inputs are just missing because the partial view has not been refreshed
EDIT:
Ok now I have a need to use this partial view in more than once place. On my dev environment the partial is rendering correctly. Uploading to the server doesn't seem to have any effect, but what's worse, deleting the partial view from the server also has the same issue.
My site still thinks the file is there and complains about the model type passed to the view now (I changed the model type in the view - all working fine on my local dev) - why does it still think the file is there?
I deleted one of the parent views to see if the site carried on working, but as soon as I delete any other file, the site is affected. Why is this particular file giving me trouble? It's as if the server has cached it at the file system level and is supplying the wrong file content to ASP.NET
I'm going to try renaming the file next
Ok so renaming the file appears to have worked.
I didn't try Fals suggestion but I might try that next time, strange behaviour I'm not going to try and understand why at this point!

Visual Basic 2010- Retrieving images using code

I am making a card game. I have 53 images for the cards and one for the back of the cards. Is there a way I can use the resource file or is there a way I can reference the folder where the program is being held with it still being relatively portable so I can move the folder and the program will still work perfectly. I thought about using a case statement and using the
My.Resources._8Hearts 'For Example
but that would take up a lot of space that I am sure can be avoided. I know this can be used to grab an image:
card1.image = System.Drawing.Image.FromFile("C:\" & variable_so_I_can_get_multiple_cards & ".png")
And using a 'for' statement to place each card in a different slot on the form
Thank you for the help
PictureBox1.Image = Image.FromFile(picPath) can retrieve an image for you,no need to add to resources in VB,and im sure u have worked with Strings so you can dynamically attach the name of each picture name (and I think also extension,.PNG seems to work best for me).
If you need it to move with the installation folder find out what your application path is using MessageBox.Show(Application.StartupPath) and then place a folder of your pictures in there and when publishing don't forget to include the folder yah? And Inno Setup (http://www.jrsoftware.org/isdl.php) is a good publishing tool...so I hear,never used it before.
If this answer works for you please dont forget to accept it as the right answer

Dojo - Some of my form.dijit's seem to be dead/inactive on one page

I was started to work on my first sample of the dijit.Tree control.
When it didn't work, I added a couple of dijit.form.Textbox'es to the screen, and they didn't work either, even though I have them working fine on a similar form.
Interesting enough, when I killed FireFox and restarted it, I was got a clear message in FireBug console on what was wrong with my tree control, and got it fixed.
But now I'm rather puzzled while the simple dijits like NumberTextBox that I added are not working.
My Samples:
1) http://3wcloud-com-provisioning-qa.appspot.com/testDijitDate - this works great
(except the initial date value not showing - I have a separate question open on that)
2) http://3wcloud-com-provisioning-qa.appspot.com/testDijitTree
I've done several "diff"s on the two files, and I kind find the difference that would cause one to work and one not to work.
Thanks,
Neal
You should put your dojo.require statements immediately in a script block, not wrapped in the onload callback. Also, your input tags should be HTML style without the XHTML style slash (you didn't declare XHTML in your document) though I doubt that's the problem. See if either of those things help.