Wednesday, 21 May 2008
|
| How to pass special characters through query string ? Sobin Thomas 17:22:45 |
| | Hi All, I want to pass a string that contains many special characters \ . _ etc) to another page in my website through query string. In my project I have a Gridview control ,in which there is a hyperlink field.The Gridview 's datasource is set as a database table at runtime.The hyperlink filed's DataNavigateUrlFields is set to "RecordID" ,which is a field in my database table.The RecordID field contains many special characters.I want to pass the RecordID to PlayRecord.aspx page .I transfer the RecordID by setting Hyperlink field's Data NavigateUrlFormat string as PlayRecord.aspx?RecID={0}.The problem is that, hyperlinks are not working as RecordID contains special characters.(It works if RecordID is a normal string). Hope you 'll surely have a solution. Thanking you in advance for your reply. Best Regards
|
| | 5 answers | Add comment |
|
| Calling an executable through a COM+ component via an asp page Guest 17:12:06 |
| | Hi all. I am working on a legacy application written in Classic ASP with VB6 COM+ components running on Windows 2003 Adv Server (32bit). There is one page in the app that uses Secure FTP to send a file to another application server upon a certain type of data change.
The way it works: Anonymous user posts the form -> ASP code instantiates the COM+ component which is starting using a Domain User -> Calls a method that creates the comma delimited data file and then calls the SFTP method -
SFTPMethod( ) 1. Writes out a script file that connects to the SFTP server, puts the file in the proper location.
2. Writes a batch file that calls the Tectia SFTP client passing the script file name as an argument - then archives the file after the script is executed.
3. Catches the return code from the SFTP client and passes the value back to the classic ASP page -> in the event of any values besides zero (Success), we display the error code and message on the page.
The Domain User has permissions to log on as a batch job, and log on as a service in the Local Security Policy. I have proven the Domain User has proper permissions to everything because I can log in to the web server as the Domain User, execute the SFTP client's command line command passing the app-generated script, and the whole thing works properly.
Furthermore, when I leave the remote desktop session open for the domain user account and run it from the web page, everything works. However, once I log the Domain User out, the transfer fails with the error 'Failed to connect to server' returned by the sFTP client.
So I know that the COM+ method being run as the Domain User can generate the data file, generate the script, call the executable, run the executable, and return the error. The SFTP client just cannot establish a connection off of the server unless the domain user has an active windows session on the server. I know I'm missing something stupid.
We have this working on an old Windows 2000 machine with the exception that the COM object is being called by a local admin user. But I can't find where the configuration is different in neither the COM component or the user's permissions. I've tried using a local admin account on this Windows 2003 server with the same error.
Any help would be much appreciated.
Thanks
|
| | 1 answer | Add comment |
|
| Re: Figuring out who the user is Bob Barrows 14:44:00 |
| | Jon Mcleod wrote:
Hello.. I'm using windows integrated security, with the following web.config: <authentication mode="Windows"/> <identity impersonate="true" userName="netuser" password="p"/> There was no way for you to know it (except maybe by browsing through some of the previous questions in this newsgroup before posting yours - always a recommended practice) , but this is a classic (COM-based) asp newsgroup. ASP.Net bears very little resemblance to classic ASP so, while you may be lucky enough to find a dotnet-knowledgeable person here who can answer your question, you can eliminate the luck factor by posting your question to a group where those dotnet-knowledgeable people hang out. I suggest microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.
And I am trying to figure out who is the actual human user sitting at the keyboard. With WindowsIdentity, I can find out all there is to know about the "netuser" account, but I need to know the signin name of the user who is actually logged into the domain. Maybe from the IIS logs?
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
|
| | 1 answer | Add comment |
Tuesday, 20 May 2008
|
| ASP.NET Forms + Frames John 22:29:58 |
| | Not sure if this is the right group for this question, but here goes:
I have a page containing 2 frames.
In the top frame, I have an ASP.NET form and 2 combo boxes, selecting an item from the first combo causes a postback to the same page, where in the SelectedIndexChanged event I fill the second combo.
The Target property of the form is set to the bottom frame.
I have a submit button in the form, the PostBackUrl property of which is set to a different page that writes the output I want in the bottom frame.
Whenever I select an item in the first combo, I get a copy of the top frame's content appearing in the bottom frame (WITH the correctly populated 2nd combo). This is as I expect, as the form is posting back but the output target is the bottom frame.
Clicking the submit button does put the correct output in the bottom frame.
My question is, how can I update the combo box contents on the form via postback, and also redirect the submission output of the form to a different frame?
Do I need to have 2 forms?
Can the form for the submit button be nested within the server form, if so, how?
I'm sure there must be a simple solution to this!
Any help greatly appreciated.
|
| | 1 answer | Add comment |
|
| Multiple Statements executed in a single step Remy 21:28:41 |
| | I have been working since 10am this morning (now after 1am in UK) on this. I can't see what the problem is.
I have a classic ASP application with a development database in MS SQL Express (All SPs applied). I have one occassasion where I would like to run an SQL Update statement and a select statement to retreive the rows affected. Code (abstracted):
strSQL = "update test set testID = 1 where testID = 1; select @@rowcount as 'RowsAffected';
I am trying to retrieve the 'RowsAffected' into a recordset and have tried rs.open and conn.execute methods. Regardless of what I try (providers, cursors etc.,) the result is always the same, the first statement executes and the 2nd doesn't. If I invalidate the second statement (malformed SQL) the expected error is thrown so its being parsed. I have changed the second statement to a simple select and its still ignored.
I can't for the life of me see what the issue is, I'm sure I did this years ago. This is time critical for me and I would be overjoyed if someone could help.
Thanks in advance.
|
| | 5 answers | Add comment |
Monday, 19 May 2008
|
| Maximum length SQL ".. not in .." Evertjan. 23:15:52 |
| | SQL = "SELECT FROM tblX WHERE Z not in ('a11','b22','c33','d44')"
Is there a maximum length of this litteral array ('a11','b22','c33','d44') ?
Or of the SQL string as such?
I would like to test 3000 plus records of 10 chars each for the few odd ones out in one go.
I am using the Jet engine.
=============
btw, can I use a real vbs array this way?
Do I do this?
a = "('" & join(arr,"','") & "')" SQL = "SELECT FROM tblX WHERE Z not in " & a
or is there a better way?
-- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
|
| | 5 answers | Add comment |
Sunday, 18 May 2008
|
| Passing parameters from ASP to MS Access query Mah-Skeet 21:14:37 |
| | Hi All,
First let me apologize if this isn't the right forum. I couldn't find an exact fit, but I'm desperate so...if you know where this should go please let me know.
Ok, I have a query in Access that runs fine if you enter empty parameters, but when I run the query from ASP I'm not getting any results (like I do in Access). Can anyone offer any advice? The code I'm using comes from http://www.xefteri.com/articles/show.cfm?id=6
Many thanks in advance,
Mark
|
| | 3 answer | Add comment |
|
| Bulkmail question Neil Gould 07:09:35 |
| | I'm preparing an ASP script to send email to club members via the club's website. In getting familiar with CDOSYS, I noticed that the recommended method of sending the same content to multiple recipients is to loop through the list of recipients. I had intended to BCC the message. Is there some reason to prefer looping through recipients?
The next task is to distribute the club's newsletter via one of the above approaches. Does this make one approach more desirable, and if so, why?
Thanks,
Neil
|
| | 9 answers | Add comment |
|
| Response.Addheader Tony 01:13:33 |
| | I've searched the web & can't find an answer to this.
Is it possible to successfully use Response.AddHeader for a robots meta tag?
For example, I want to do
<% IF request("PageID") = 252 THEN Response.AddHeader "robots", "noindex" : %>
|
| | 8 answers | Add comment |
Saturday, 17 May 2008
|
| Read from client machine Titus 15:33:11 |
| | Hi all, To secure my web site i need to read client Machien's MAC Address with javascript,
Can any body help me?
|
| | 2 answer | Add comment |
Friday, 16 May 2008
|
| divisiorn problem .nLL 23:35:04 |
| | <%=2/33334%>
returns 5.99988000239995E-05
how can i convert it to a n.nn ?
|
| | 3 answer | Add comment |
|
| IF exist /w FSO EQNish 21:17:47 |
| | IS there a way I can do an If exist to determin if a graphic is displayed?
something like this;
<p align="center">
if file exist "fileone.jpg" <img border="0" src="fileone.jpg"> if File exist "filetwo.jpg" <img border="0" src="fileone.jpg"> </p>
What I am trying to do is post JPGs from a folder structure, the files may or maynot be there, but I don't want to have the blank picture reference to be displayed as if I where to just hard code the graphics in the Html!
|
| | 2 answer | Add comment |
|
| CDO.Message problems Andrew Wan 19:01:21 |
| | I use CDO.Message to send mail. The problem is, CDO.Message will send to any malformed address, (eg. smtp:email.address@domain.com) and no errors are thrown. That's ok.
Is there any way to receive bounced messages?
|
| | 1 answer | Add comment |
|
| Problem getting hacked with this new SQL injection Tool. Adword71 and direct84 Lance Wynn 18:27:37 |
| | One of my server has been compromised from this virus, and I can't seem to block it out! I have shut down the infected server, but I need to figure out how to check for this, and stop it.
The site is running iis5 on Windows2000, the backend DB is SQLServer 2000
Can anyone point me to some good resources for this? This is urgent!
Thanks alot Lance
-- Support Fairtax Legislation www.fairtax.org
"A government big enough to give you everything you want, is strong enough to take everything you have." -Thomas Jefferson
|
| | 17 answers | Add comment |
Thursday, 15 May 2008
|
| RE: Problem getting hacked with this new SQL injection Tool. Adword71 Plange 21:09:01 |
| | This happened to me too, and it's some new SQL injection -- see http://cyberinsecure.com/phishing-botnet-expands-by-sql-injecting-websites-found-in-google/
"Lance Wynn" wrote:
One of my server has been compromised from this virus, and I can't seem to block it out! I have shut down the infected server, but I need to figure out how to check for this, and stop it. The site is running iis5 on Windows2000, the backend DB is SQLServer 2000 Can anyone point me to some good resources for this? This is urgent! Thanks alot Lance -- Support Fairtax Legislation "A government big enough to give you everything you want, is strong enough to take everything you have." -Thomas Jefferson |
| | Add comment |
|
| ADO issue (new) Dannasoft 19:57:22 |
| | I have a strange problem. ASP pages that have worked for years are suddenly giving me errors. Here's the scenario.
Server: Win2k Server running IIS
Opening ADODB recordsets. First recordset on page opens fine, but after closing it I try to use the same recordset object to open a second recordset and I get the following errror.
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21) ODBC driver does not support the requested properties.
Usually this is from a bad sql string used to open a recordset but the string is good. It only happens when re-using an existing recordset object to open a second recordset after closing the first.
Anyone experience this lately? Could it be some update on the server causing it?
|
| | 6 answers | Add comment |
|
| Opening a New Window with no toolbars etc Anon 14:16:44 |
| | I have a page where the ASP script create a table of links
i.e. 1 = NextPage.asp?Item=1 2 = NextPage.asp?Item=2
etc
What I would like to do is open an new window with this link without any toolbars, addressbars, scrollbars and tabs. I would be happy even if the control to limit the appearance of the new window was in the new asp page.
Any suggestions or pointers would be greatly appreciated.
Thanks,
Rob
|
| | 15 answers | Add comment |
|
| RSS - Whitespace is not allowed at this location. Mark R 12:14:13 |
| | Trying to create a page like popurls displaying rss feeds from music sites only im trying with one to start from NME.com and the output errors with the message "Whitespace is not allowed at this location."
anyone help?
DEMO: http://mngr.co.uk/rss1.asp
Code: <%@ Language="VBScript" %> <% Option Explicit %> <% Response.Charset = "UTF-8" %> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ASP 101's MegaTokyo RSS Feed Reader</title> </head> <body>
<% If DateDiff("h", Application("MegaTokyoUpdated"), Now()) >= 2 _ Or Request.QueryString("force") <> "" Then
Dim objXML Dim objItemList Dim objItem Dim strHTML Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument") objXML.async = False
objXML.setProperty "ServerHTTPRequest", True objXML.Load("http://nme.com/rss/news.xml") 'objXML.Load(Server.MapPath("megatokyo.xml"))
If objXML.parseError.errorCode <> 0 Then Response.Write "<pre>" & vbCrLf Response.Write "<strong>Error:</strong> " & objXML.parseError.reason Response.Write "<strong>Line:</strong> " & objXML.parseError.line & vbCrLf Response.Write "<strong>Text:</strong> " _ & Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf Response.Write "</pre>" & vbCrLf End If
Set objItemList = objXML.getElementsByTagName("item") Set objXML = Nothing
For Each objItem In objItemList ' MegaTokyo Feed childNodes: 0=title, 1=link, 2=description strHTML = strHTML & "<p>" & vbCrLf strHTML = strHTML & "<a href=""" & objItem.childNodes(1).text & """>" strHTML = strHTML & "<strong><em>" & objItem.childNodes(0).text strHTML = strHTML & "</em></strong></a><br />" & vbCrLf strHTML = strHTML & Replace(objItem.childNodes(2).text, "<br>", "<br />") & vbCrLf strHTML = strHTML & "</p>" & vbCrLf Next
Set objItemList = Nothing
Application.Lock Application("MegaTokyoContent") = strHTML Application("MegaTokyoUpdated") = Now() Application.UnLock End If %>
<%= Application("MegaTokyoContent") %> <!--<%= Application("MegaTokyoUpdated") %>-->
</body> </html>
|
| | 1 answer | Add comment |
Wednesday, 14 May 2008
|
| Text in ASP Scripts Hidden From Windows Search Perrinwolf 21:34:02 |
| | Not sure where to post this...
Found some interesting behavior in Windows Search (Start => Search => All files and folders => search for "A word or phrase in the file:"). This applies to XP and maybe other Windows flavors.
Procedure: 1. Create a simple text file named test.txt. 2. Open the text file in a text editor and add a simple test word such as "blah" (not quotes). 3. Save the text file. 4. Using Windows search, attempt to locate this new text file by searching for files containing the word "blah" (no quotes). Recommend limiting search to folder that contains the new text file and deselect search subfolders option. 5. The file should be found. 6. Change the file extension of the text file from .txt to .asp. 7. Redo the search. 8. The file should be found. 9. Reopen the text file (now named test.asp) in a text editor. 10. Change the string "blah" to "<% blah %>" (without quotes). [The brackets delineate script in asp files.] 11. Save the changes. 12 Redo the search. 13. The file is NOT found.
Interesting. There must be some security concern related to .asp files with embedded scripts relative to Windows Search. I wonder if there is a KB article or something about to this. I have not been able to find anything.
Can anyone shed any light on this behavior?
Does anyone know of a good tool to find files containing a specific string/pattern? Cygwin and some of the Unix tools works, but a GUI tool like Windows Search would be preferrable.
Thanks.
|
| | 3 answer | Add comment |
|
| Freeing Dynamic Arrays Headware 21:29:51 |
| | Do dynamic arrays declared using ReDim have to be freed? I assume that if it's an array of dynamically created objects (e.g. Scripting.Dictionary), each one of those objects will have to be set to Nothing in a for loop, but what about the array itself? Or what if the array is dynamic but it just consists of integers or strings, not dynamically allocated objects? Does it have to be set to Nothing?
Thanks, Dave
|
| | 4 answer | Add comment |
|
| Product activation code B. Nelsen 20:52:38 |
| | Hello, I have an ASP provider and an Access Database. I need to build a small webpage where the user can enter his "user id" and a "hardware code", and if the "user id" is correct (will be checked against the db which means the user id must exist) a function will generate a product activation code from his/ her "hardware code" and show it on the next page.
I think the database thing is not a problem, but I have not been able to create a simple function that is hacksafe and cannot be "downloaded". Could anybody give me a hint where I can find an example of such a function so that I can understand how I have to encapsulate the important parts so that nobody can see it?
Thank you very much!
|
| | 1 answer | Add comment |
Tuesday, 13 May 2008
|
| Create Window width new Session: solution MrZed 13:08:17 |
| | I run into this problem, and I read many places that these is not solvable.
I have one solution (workaround), not simple, a little trickier, limited, but possible and usable. My main problem was, that I have a complex site, and I have to make an archive site. Part of database is moved to the archive database (same structure), and the web should be the same (different users and rights stored in 2nd db) ... and I have to open it from the main site so, that both sides work simultaneously with different sessions ...
Solution: In the IIS you have to make Virtual Directories as application (example: test and test1, and because I am lazy, they local path is the same directory, they use the same files) Normally you call the site by the server/test address (so here http://server/test/test.asp) In the test asp if you click to open a new window ( javascript:window.open(...) ), you use the other IIS Virtual Directory, so there you open it as http://server/test1/test.asp And so in the new window you have the same test.asp running, but width a different session and sessionID
Test.asp is simple (called as http://server/test/test.asp ): <html> <head> <title>NewID test</title> </head> <body> <table><tr> <td>SessionID: <%=Session.SessionID%></td> </tr></table> <input type="button" onClick="newwindow()" value="new window">
<script language="javascript"> function newwindow() { window.open('/test1/test.asp','','toolbar=no'); </script>
</body> </html>
It is limited, because for every new session a new Virtual Directory is needed (like a working thread, but I only need +1 )
if someone has an easier solution, don't hesitate to share ;)
Zed
|
| | 1 answer | Add comment |
|
| Code Snippet Respository StreamLogic 06:24:52 |
| | All,
I have posted this question in various groups, so I apologize for any overlap.
I'd like to hear how other developers/architects keep track of old scripts, code snippets, relevant URLs, etc. I think most developers have an area where they keep reusable code they would like to use again. Year after year, we all develop things that can be reused in various projects.
Do you simply have a file system folder where you dump all of this information and then search on it? Do you have a custom database solution for this?
I'd like to hear how others are keeping track of many years worth of code snippets and scripts that they would like to reuse at some point.
Thanks, Curtis
|
| | 1 answer | Add comment |
|
| File Attributes with ASP in HTML EQNish 02:36:59 |
| | Not sure if this is the spot to ask but I need some help with a script I hijacked and put to my own use in an .ASP page
any ways I am using the FilesystemObjects to get a directory and file listing and generating a web page of that listing, but I need to filter out files with the SYSTEM tag, so it wont show files I dont want it to, Below is my full code for the ASP page, I have Commented where I need to change the listing structure, if anyone can help me filter these out I would be greatfull!!!
--- Begin code --- <%@LANGUAGE="VBSCRIPT"%> <% Option Explicit On Error Resume Next
' this section is optional - it just denies anonymous access If Request.ServerVariables("LOGON_USER")="" Then Response.Status = "401 Access Denied" End If
' declare variables Dim objFSO, objFolder Dim objCollection, objItem
Dim strPhysicalPath, strTitle, strServerName Dim strPath, strTemp Dim strName, strFile, strExt, strAttr Dim intSizeB, intSizeK, intAttr, dtmDate
' declare constants Const vbReadOnly = 1 Const vbHidden = 2 Const vbSystem = 4 Const vbVolume = 8 Const vbDirectory = 16 Const vbArchive = 32 Const vbAlias = 64 Const vbCompressed = 128
' don't cache the page Response.AddHeader "Pragma", "No-Cache" Response.CacheControl = "Private"
' get the current folder URL path strTemp = Mid(Request.ServerVariables("URL"),2) strPath = ""
Do While Instr(strTemp,"/") strPath = strPath & Left(strTemp,Instr(strTemp,"/")) strTemp = Mid(strTemp,Instr(strTemp,"/")+1) Loop
strPath = "/" & strPath
' build the page title strServerName = UCase(Request.ServerVariables("SERVER_NAME")) strTitle = "Contents of the " & strPath & " folder"
' create the file system objects strPhysicalPath = Server.MapPath(strPath) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) %>
<html>
<head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title></title> </head>
<body text="#C0C0C0" bgcolor="#000000">
<div align="center"> <table border="0" width="80%" id="table1"> <tr> <td align="center">Some web page Info here<p align="right"><b><font size="4">And here</font></b></td> </tr> </table> </div> <p align="center"> <img border="0" src="Folder.jpg"> </p>
<p align="center"><a href="../">Back</a></p>
<html> <body>
<div align="center"><center> <table width="100%" border="0" cellspacing="1" cellpadding="2">
<% '''''''''''''''''''''''''''''''''''''''' ' output the folder list ''''''''''''''''''''''''''''''''''''''''
Set objCollection = objFolder.SubFolders
For Each objItem in objCollection strName = objItem.Name strAttr = MakeAttr(objItem.Attributes) dtmDate = CDate(objItem.DateLastModified) %> <% Next %>
<% '''''''''''''''''''''''''''''''''''''''' ' output the file list ''''''''''''''''''''''''''''''''''''''''
Set objCollection = objFolder.Files
For Each objItem in objCollection strName = objItem.Name strFile = Server.HTMLEncode(Lcase(strName))
intSizeB = objItem.Size intSizeK = Int((intSizeB/1024) + .5) If intSizeK = 0 Then intSizeK = 1
strAttr = MakeAttr(objItem.Attributes) strName = Ucase(objItem.ShortName) If Instr(strName,".") Then strExt = Right(strName,Len(strName)-Instr(strName,".")) Else strExt = "" dtmDate = CDate(objItem.DateLastModified) %> ' This is where I am listing the Files in my webpage, but it lists all files, and I need to block the listing of system Files' <tr> <td align="left">A<%=strFile%></a></td> <td align="right"> </td> <td align="right"> <p align="left"><%=intSizeK%>K</td> </tr> <% Next %>
</table> </center></div>
</body> </html>
|
| | 1 answer | Add comment |
Monday, 12 May 2008
|
| asp datatable? Gold Herman 22:14:54 |
| | Hi i am using classical asp and have a problem that I hope someone can provide an elegant suggestion.
I have a recordset return rows looking like
Name,Stage,Amt joe,s1,20 joe,s3,30 sam,s2,10 sam,s3,20 sam,s4,30
and I like to constuct an html table looking like:
name s1 s2 s3 s4 s5 joe 20 0 30 0 0 sam 0 10 20 30 0
The stage is fixed s1 to s5 but not all names have all stages. Any hints how I can convert a recordset to this kind of table?
|
| | 1 answer | Add comment |
|