I'm new to ASP, VBScript and am trying to figure out how to change some text on a webpage.
What I want to do:
Change some text in a web page
The problem:
The web page (.asp) text seems to be generated by code that looks like this: <% Set MyAd = Server.CreateObject("ETFramework11.WPLoginPage") %> and I cannot directly see the text that I want to change.
Question:
Where does the file(s) housing the ETFramework11 or WPLoginPage reside physically? (assuming that they reside in separate files somewhere) What are the file types? What do they look like?
CreateObject is used to instantiate a COM object. So ETFramework11.WPLoginPage is an object in a DLL somewhere. You will need to find out where that object pulls the files from if at all - if not, then it is embedded in the DLL and I would contact the vendor.
You can find out where the DLL is located by searching for the object name (i.e. ETFramework11.WPLoginPage in the registry).
They are called COM components which is a spec different technologies can implement. I think most of the ASP world implemented them with a technology called ActiveX.
The file can theoretically reside anywhere. The system is told about the COM components through the "Regsvr32" command.
Related
A bit of an odd use-case scenario but I have the need for a program
that allows users to select file(s) and have those full path file
names sent to a SQL database.
I’ve built said program in ASP .NET Web application written in VB
using Visual Studio 17.3.5. The FileUpload Control records the users
selected files and those filenames successfully transfer to the SQL
database.
The problem I’m having is it appears the FileUpload control is doing
what’s it’s designed to do… actually upload the file, not sure where
but I’m assuming to some temp space. I noticed this when I selected
a large file to test with, there was a lag in the system and if the
file was larger than ‘maxRequestLength’ it would crash. Again my goal
is to record and save just the filenames of the selected files not the
actual files themselves.
If it wasn’t obvious I’m very green when it comes to coding, any help
is greatly appreciated!
Initially I increased 'maxRequestLength' in the Web.config but that
didn't address the problem, which is the FileUpload control is
actually uploading or trying to upload the file somewhere.
Current code related to FUD:
*Side note: I’m using a Wizard control and this code is submitted/executed when the user clicks ‘Finish’ at the end of the Wizard.
If fud_SelectFiles.HasFiles Then
For Each uploadedfile In fud_SelectFiles.PostedFiles
StrFile_Name += String.Format(Server.MapPath(uploadedfile.FileName)) + ","
'Trims last comma from file name and places into session variable
Session("v_File_Name") = StrFile_Name.TrimEnd(",")
Next
End If
We have a windows forms legacy asp.net site that uses the AjaxFileUpload control to manage file uploads. One of our issues is that we have different file type uploads but these types are distinguished not by the extension, but by an element right before the extnsion, EG: .gh.zip vs. .gy.zip. It seems that if I add one of these, but not the other, to the AllowedFileTypes, it doesn't allow either. Is it possible to piggyback some additional JS validation code to prevent an invalid file name, or would I need to replace the entire module with something else, and if so, what would be the recommendation for something that's going to be the least time-consuming that will offer a reasonable amount of configuratability?
That control is open source - you can download the source and change it if you wish.
However, why would not just specifying zip as allowed file type work?
If I set a allowed extension of zip?
Then all of these work:
.gh.zip ok
.gy.zip ok
.pdf no
However, my markup is this:
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
OnClientUploadCompleteAll="MyCompleteAll" ChunkSize="16384"
AllowedFileTypes="zip"
/>
So, above only allows zip files.
if I try to say add a pdf file to above que, then I get this:
So just add allowed extension type = zip
(Edit: do NOT include the "." in this extension)
I not sure why that would not work?
But as noted, you can grab the source - it is open source code now.
However, I suspect perhaps some other issue is going on here?
Or maybe you need "more" complex file extensions parsing?
I mean, you could for the "rare" cases or say some "out liner" cases allow that file up-load, and THEN the post-processing code could reject the file type anyway, right?
However, looking at above, just specify file type = zip, and you should be ok.
I have two .resx files: en.resx and he.resx, in the folder App_LocalResources.
I already have two buttons in my web page, clicking each one is supposed to "switch" to the other language's resource file.
I want to simply get a string value located in one of the .resx files.
I tried some of the examples I have found on google, and I asked myself, why do I need to provide an Assembly type and a namespace, when i just want to ask for a string value in my own project?
Why isn't there something like: string val = Resources["en.resx"]["SomeProperty"].Value?
Maybe my whole approach is wrong, and I would like to read your opinions.
Thanks, Guy
using System.Resources;
ResXResourceSet Resource = new ResXResourceSet(HttpContext.Current.Server.MapPath(#"~/Properties/Resource.resx")
String value=Resource.GetStrin("key");
I was wondering if it was possible to load a asp.net control (.ascx) that doesn't reside on the file system?
Like say a string variable?
Not a string varible but you can load it from resources or zip file, but you have to have full trust. Google for VirtualPathProvider.
As of 4.0 you don't have to have full trust.
System.Reflection.Emit
Assembly.Load(byte[])
No designer for you if you do this though.
You could try this:
string controlString = //read or build it
Control control = this.Page.TemplateControl.ParseControl(controlString);
More information is available here:
http://msdn.microsoft.com/en-us/library/kz3ffe28.aspx
I was wondering what's the best practise for serving a generated big file in classic asp.
We have an application with "export to excel" function that produces 10MB files. The excels are created by just calling a .asp page that has the Response.ContentType set to excel and has an HTML table for the data.
This gives as problem that it takes 4 minutes before the user sees the "Save as..." dialog.
My current solution is to call an .asp page that creates the excel on the server with AJAX and lets the page return the URL of the generated document. Then I can use javascript to display the on the original page.
Is this easy to do with classic asp (creating files on server with some kind of stream) while keeping security in mind? (URL should make people be able to guess the location of other files)
How would I go about handling deleted the generated files overtime? They have to be deleted periodicly as the data changes in realtime.
Thanks.
edit: I realized now that creating the file on the server will probably also take 4 minutes...
I think you are selecting a complex route, when the solution is simple enough (Though I may be missing some requirements)
If you to generate an excel, just call an asp page that do the following:
Response.clear
Response.AddHeader "content-disposition", "attachment; filename=myexcel.xls"
Response.ContentType = "application/excel"
'//write the content of the file
Response.write "...."
Response.end
This will a start a download process in the browser without needing to generate a extra call, javascript or anything
See this question for more info on the format you will choose to generate the excel.
Edit
Since Thomas update the question and the real problem is that the file take 4 minutes to generate, the solution could be:
Offer the user the send the file by email (if this is a workable solution in you server or hosting).
Generate the file async, and let the user know when the file generation is done (with an ajax call, like SO does when other user have added an answer)
To generate the file on the server
'//You should change for a random name or something that makes sense
FileName = "C:\temp\myexcel.xls"
FileNumber = FreeFile
Open FileName For Append As #FileNumber
'//generate the content
TheRow = "...."
Print #FileNumber, TheRow
Close #FileNumber
To delete the temp files generated
I use Empty Temp Folders a freeware app that I run daily on the server to take care of temp files generated. (Again, it depends on you server or hosting)
About security
Generate the files using random numbers or GUIds for a light protection. If the data is sensitive, you will need to download the file from a ASP page, but I think that you will be in the same problem again...(waiting 4 minutes to download)
Read file using FSO.
Set headers for Excel file-type, name according to file read and for download (attachment)
Flush response after headers are set. The client should display "save as" dialogue.
Output FSO to response. Client will download file and see progress bar.
How do you plan to generate the Excel? I hope you don't plan to call Excel to do that, as it is unsupported, and generally won't work well.
You should check to see if there are COM components to generate Excel that you can call from Classic ASP. Alternatively, add one ASP.NET page for the purpose. I know for a fact that there are compoonents that can be called from ASP.NET pages to do this. Worse come to worst, there's an Excel exporter component from Infragistics that works with their UltraWebGrid control to export. The grid need not be visible in order to accomplish this, but styles in the grid translate to styles in the spreadsheet. They also allow you to manipulate the spreadsheet programmatically.