Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reading from the Registry

    I am getting the persistent error "<font face="Georgia">Unable to open registry key [registry path string] for reading</font face=georgia>." this shows me the path is valid but that's about it. This has NOTHING to do with that jet db issue.

    In Googling, I've gotten dim hints about a bug in the Wscript.Shell object that cause it to try to read the default value in a key rather than *what's there* but I haven't seen a clear (to me) discussion on how to work around that. I'll keep mucking around but lemme know if you guys have any ideas.

    ASP Classic using the <font face="Georgia">Server.CreateObject("WScript.Shell" )</font face=georgia>

    Thanks!

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    Are you trying to read from the registry, or are you just trying to create a WScript.Shell object for other purposes?

    In either case, I would be concerned abou security settings since IE is very restrictive with allowing access to potentially dangerous components like WScript.Shell.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    of course i'm trying to read from the registry. why else would i create a post called 'Reading from the Registry'? This is for an Intranet web application, so I should be able to negotiate the security issues, hopefully.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    Since you didn't post any details of what you want to accomplish or any substantial code, I'm not quite clear on your goals.

    If you use Server.CreateObject() in ASP code, it's going to read from the registry on the server. If you want to read from the registry of the client, you'll need to do this in JScript or VBScript in client-side code.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    Sorry if I wasn't being explicit enough. I want to read registry values on the client when a page loads and when the page unloads. loading and unloading events are, i believe, things that apply more to javascript than vbscript, no?

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Reading from the Registry

    What is the format of the key in your code?

    ...VendorProductSettings
    ...VendorProductSettings
    ...VendorProductSettingsParticularSettingName

    In other words:

    KeyName
    KeyName
    KeyNameValueName

    All might return something different. Or nothing, depending on what you have in there.

    And I wouldn't rule out a security restriction... I certainly don't want web pages diddling my registry!

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    I think there's a security restriction going on here. I am trying to read the value in the Page Setup dialog when a specific page in a intrAnet web app loads so i can change those values, and reset on page unload.

    This is a private, intranet web application and as the authorized programmer for my company (which owns the machines), i am not doing any 'diddling' on someone elses' registry.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Reading from the Registry

    I didn't mean to suggest that you weren't authorized to do whatever your application requires. But I like web applications to play in their own sandbox and not get outside of it. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  9. #9
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    well, whatever. this is getting a little too much on a religious differences issue. if I can access the settings in code, I can definately re-set them to whatever they were before making any changes, so i don't see where the big awful sin is.

    at any rate, it's starting to look impossible to do in ASP code. MS says the only way to access the header/footer settings in IE is via C++. I *can* access other registry settings, such as local date/time, using the same code, so my basic approach is alright.

    Really frustrating! This goes back to the IE 5.5 days, when MS was doing really cool stuff and someone in upper management (I guess) put the kibosh on enabling IE to deploy really competent web applications. This, I think, is a case in point: really prevent access to a simple setting in IE that would make it easy for developers to deploy nice printer-friendly pages. here's a very interesting article about that:
    http://www.joelonsoftware.com/articles/APIWar.html

  10. #10
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    At the risk of exposing additional "relivious differences" here, I thought I'd pitchin my 2 cents. <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>

    A web browser is a web browser - not an application environment. It's designed to present HTML, display plugins (Java, ActiveX, etc), and provide utilitiy functionality (printing HTML pages, bookmarks, other ease-of-ues features).

    It just happens that developers learned how to make HTML-based applications work in this environment. It's not ideal for all situations (i.e. formatting pages for printing), but it does allow some basic functionality.

    If your needs extend beyond the reasonable capabilities of the native browser, your best bet is to use a different environment to deliver the desired feature(s). In the case of needing to properly format printed pages, your best bet will be to deliver them via generated PDF or to use a reporting tool such as ActiveReports or SQL Reporting Services. Those tools (and many others) are specifically intended to provide page formatting capabilities and they do a great job at it.

    The investment in training, licensing costs, and development may be greater upfront. However these applications will pay off in the long-term due to the fact that they are doing what they are designed to do, and not operating based on a potential security hole-driven hack. What's going to happen when MS updates the browser or OS code and breaks this functionality?

    Hope this helps.

  11. #11
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    errrgg....

    all i want to do is reset the default header/footer on print! how is this 'unreasonable'? how is it, looking the other way, 'reasonable' that people have to deal with MS-determined defaults when printing a webpage? I know, you are able to change the settings yourself, but in my experience I have not seen many people do that.

    again, how is accessing header/footer in code a huge security risk? If you say 'that is a user defined setting, so you are a sinner to try and change it', I'll reply 'sure if I don't reset it to what it was', so that issue is one of best practices. There's some assumption of a bright line here that I don't buy, and in this situation (writing company code to run on a company web app for company computers) it's even less obvious to me. I find this limitation irksome because it seems arbitrary and silly. It would be a great feature for programmers to use, but for some reason (to push people to implement PDF or Reporting Services, perhaps?) it's buried.

    as for going to PDF I may have that option -- I can defiantely do RTF. unfortunately, doing either one of these will make it VERY difficult for me to implement the text formatting features I have in the webpage, so the application will be less robust. I'm using this freeware code called htmlarea that allows users to cut and paste from Word into a Rich Edit textbox which preserves Word formatting by converting the word formatting to html markup. It's really nifty but, if I output the formatted text to RTF/PDF I get the html formatting code, and that's obviously a Bad Thing. That's really the main point of my frustration, that I will probably drop a very nice feature because...I can't make this one change. OTOH, perhaps not... there are only two people in the org that will be printing these reports, so I may just have them turn off the URL string on their browsers manually. which means i'll look into ways to prevent anyone else from printing the reports...

    a bit of a mess!

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    I don't disagree with your frustrations. I guess I've just learned to accept a certain level of modularity and best practice in the web application world.

    As for the RTF/PDF issue, I've come across a similar challenge before. I ended up locating a windows-based control that converted HTML to RTF. Even though it was a windows forms control, I could still use the input/output functionality of it behind the scenes on the web server. I let the user paste code into a text area (much like the one you described), which convered it into HTML code. My control took the HTML and generated RTF code from that. Then I took the RTF code and pasted it into a RTF control on the PDF-generating software. I was able to produce the correct formatting with this solution.

    (In case it may not make sense, the reason I converted pasted-RTF into HTML is that the web control also allowed native HTML formatting.)

  13. #13
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    Can you give me a little more detail on your solution? by a windows form control, do you mean something in, say VB6 or .NET? I have found a variety of utilities that will do HTML-RTF conversions but nothing for the right price <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15> .

    I can think of a way to do it on my own, but we're talking a lot of coding (not that that's a BAD thing) but I want to wap out a solution fairly quickly. FWIW, htmlArea can and will use mso-type HTML formatting tags. All things considered, I'd actually prefer to do this as a PDF file but the last time i worked on it (using something called ActivePDF) I was getting unsatisfactory results in the arbitraily large textarea sections of the PDF form: the result file would attempt to shrink the text in the textarea form field rather than just emit another page. There's probably something I was doing wrong but I haven't gotten back to that yet as there are potential issues with being able to use the SW on the enterprise webserver in the first place. This isn't an issue with RTF of course, but then again RTF files are editable, which introduces a whole other set of concerns.

  14. #14
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    A quick Google for html to rtf turns up quite a few tools to accomplish this goal.

    Since my solution was in .NET I doubt it would help your situation. The gist of it was that I employed the functionality of a component to accept a string of HTML and return a string of RTF. I then set the value of an RTF control in a report generation tool to the RTF string, which ultimately generated a PDF with the correct formatting.

    The search I mentioned above has several controls that appear they will work in Classic ASP.

  15. #15
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading from the Registry

    .NET, huh? well, we *kind* of have that here, sorta. it's not on the enterprise webserver (the framework, that is) but we'll probably implement it on our in-house webserver. took a week-long class in ASP.NET last month...gosh, it looks a LOT like Java...

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •