How do I add a photo to my comment or blog entry?
ASP web-programming
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > ASP web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:
Monday, 25 August 2008
Can't debug? Bob Altman 18:04:06
 Hi all,

I'm a very experienced VB.Net developer just starting to climb up the
ASP.Net learning curve. I followed a couple of the beginning "how to"
tutorials included with the MSDN docs, but I've run into a problem that I
can't figure out. When I run my simple ASP.Net web app under the debugger,
it doesn't stop at any breakpoints.

Here are the details: I'm using VS 2005 Team Suite SP1. I created the
solution by selecting "Create: Website" from the start page and selecting
the "ASP.Net Web Site" template. The first time I tried running under
debug, I got a polite message telling me that I needed to uncheck the
"Disable script debugging" setting in Internet Properties, which I did.
That made the message go away, but that didn't help. I've checked my
web.config file and it contains

<compilation debug="true" strict="true" explicit="true"/>

When I press F5, Visual Studio looks like its starting to run under debug,
but then my web page is displayed and breakpoints are simply ignored. (The
red ball next to the breakpoint is filled in, indicating that the debugger
is happy with that line. And I know it has to be executing that line
because I see the result on my web page.) Another strange behavior is that
the part of the VS text editor that was occluded by my web page when it was
displayed is not redrawn correctly, leading me to suspect that VS is somehow
unnaturally unhappy with something I'm doing.

Any suggestions?

TIA - Bob

comment 6 answers | Add comment
Upgrading to ASP.Net Dave1031 01:08:21
 I know I am quite behind the times but I need to finally upgrade our website
from classic ASP 3.0 to ASP.Net.

I plan on creating apsx pages with the same names as the old asp pages.
Then remove all of the code from the old asp page with the exception of a
Response.redirect to the comparably named apsx page.

Is this pretty much standard practice when upgrading?

Any insights from someone who has done this?
comment 2 answer | Add comment
Sunday, 24 August 2008
Increase Width of GridView Column Dmbuso 16:44:02
 How do I increase the default width of a gridview column (just one column,
the 10th column, named "Notes")?

In design mode, I changed the width properties of the HeaderStyle,
ControlStyle, and ItemStyle to 300 px and set Wrap to False for the
HeaderStyle and ItemStyle. When I accept settings the "Notes" field widens in
design mode but when I run the web site, the Notes field is back to default
width.

PS - My gridview is bound to SqlDataSource1 which is a SELECT statement to a
SQL Server 2005 database table.

--
Dave B.
comment 2 answer | Add comment
Saturday, 23 August 2008
problem with javascript in asp not rounding up.. Gtn170777 16:58:50
 Hi All,

I have a neat little script that calculates price based on quantity without
refreshing the page.. the script is -

<script type="text/javascri­pt">
function OpenWin(url)
{
window.open(url,'wi­n','scrollbars=1,sta­tus=0,resizable=0,wi­dth=200,height=265')­;
}


function btnCalculate_onclic­k()
{
var numQty;
var adprice;

if (isNaN(document.frm­Client.txtQty.value)­)
{
alert('Please enter a number for advert quantity.');
}
else
{
numQty = parseInt(document.f­rmClient.txtQty.valu­e);
adprice = parseInt(document.f­rmClient.adprice.val­ue);

if((numQty >= 1) && (numQty <= 1)){
document.getElement­ById('divPrice').inn­erHTML = ' ' + adprice + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(100*(adp­rice * numQty))/100 + ' + VAT';
} else if((numQty >= 2) && (numQty <= 10)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.95)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.95 + ' + VAT';
} else if((numQty >= 11) && (numQty <= 20)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.85)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.85 + ' + VAT';
} else if((numQty >= 21) && (numQty <= 30)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.75)/numQty­ + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.75 + ' + VAT';
} else if((numQty >= 31) && (numQty <= 50)){
document.getElement­ById('divPrice').inn­erHTML = ' ' +
(Math.round(adprice­ * numQty)*.5)/numQty + ' + VAT';
document.getElement­ById('maindivPrice')­.innerHTML = ' ' +
Math.round(adprice * numQty)*.5 + ' + VAT';
} else {
alert("Please contact us for more information about the benefits of our
monthly account packages.");
}
}
}</script>

The problem I have is that it doesn't round up, for instance in stead of
0.95 i get 0.9499999999998.

Does anyone have any ideas how to fix this?

Many thanks
comment 15 answers | Add comment
Friday, 22 August 2008
Output to Excel 2007 Displayname 19:39:01
 The following code used to outputs to Excel 2003 fine. Do I need to change it
to output to Excel 2007?
<%
Response.ContentTyp­e = "application/vnd.ms­-excel"
Response.AddHeader "Content-Dispositio­n", "attachment; filename=List.xls"
%>

In addition, it pops a small File Download - Security Warning window showing
the Name: List.xls
Type: MS Excel 97-2003 Worksheet, 2.66 MB
and it displays the output in Excel fine.

But other times it it pops a small File Download - Security Warning window
showing the
Name: MyAspPage_asp (instead of List.xls)
Type: MS Excel 97-2003 Worksheet, 416 bytes
and when I click on Save it shows error:
IE cannot download MyAspPage.asp
and if I click Open instead of Save it will pop up a small Microsoft Office
Excel window with the following error:
"Microsoft Excel cannot access the file
'https://www.myurl.­com/dir1/MyAspPage.a­sp'. There are several possible
reasons:
- The file name or path name does not exist.
- The file you're trying to open is being used by another program. Close
the document in the other program, and try again.
- The name of the workbook you're trying to save is the same as the name
of another document that is read-only. Try saving the workbook with a
different name."

Add comment
how to retrieve CheckBox value using GET Method ? Magix 19:29:30
 If I have

<form action="process.asp­" method="get" name="form1">

...
...
<input TYPE=checkbox name=sports VALUE=Cricket>
<input TYPE=checkbox name=sports VALUE=Swimming>
<input TYPE=checkbox name=sports VALUE=Football>

</form>

If I check all, when submit, I will get in URL string

http://....?... &sports=Cricket&spo­rts=Swimming&sports=­Football

So, in process.asp, how can I differentiate each of them with
request.querystring­("sports)?
How cna I know how many "sports" have been selected ?
Assume that all must having same checkbox name, and must use GET method,
instead of POST

Thanks.

regards,
Magix


comment 9 answers | Add comment
Re: Payment Gateway in asp Dave Anderson 16:47:09
 <vinodkus@gmail.com>­ wrote:
Please tell me how to do payment gateway in asp .
please provide me coding or refer me any site so that I can
understood it easily. I have to do it with ICICI bank. I have
been provided a link for it but i dont know how to implent it.

There are a small list of payment gateways here:
http://en.wikipedia­.org/wiki/Payment_ga­teway

Each ought to be able to provide you samples for working with their
products.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Add comment
Internacionalization Paulo 15:45:16
 What is the best approach? Using DB wich stores the translation of the
variable used on site for each language?

LANGUAGE_CODE, VARIABLE, TRANSLATION
1,'CustomerWord','C­ustomer'
2,'CustomerWord','C­liente' -> 'BR Portuguese

Thanks


comment 3 answer | Add comment
CDO.dll or cdosys.dll Jerry C 05:19:26
 I am working on a program that gets mail messages from the default SMTP
server with iis 6.0 on windows server 2003. I am using the cdosys.dll in the
system32 directory. The reference Name is "Microsoft CDO for Windows 2000
Library".

On the machine there is a CDO.dll in the Program Files\Common
Files\System\MSMAPI­\1033 directory.

The question is which one of these is the current dll. I also wonder if
there is better way to access mail messages in the SMTP server. Does the
dotnet framework have a object for this like system.net.mail that does this.

I am using the objects:
Dim objDropDir As New CDO.DropDirectory
Dim objMessages As CDO.IMessages
Dim objMailMessage As CDO.IMessage
Dim MailAttachments As CDO.IBodyParts
Dim MailAttachment As CDO.IBodyPart

to get messages in the drop directory (.eml files) open them and get any
attached file.

Thank you


--
Jerry
comment 2 answer | Add comment
Thursday, 21 August 2008
RE: Please Help Advanse Search, two parts are working, the 3rd to conn Old Pedant 22:45:09
 
First, change your options for the salary to this:

<select name="Salarycom" size="1">
<option selected value="">All</optio­n>
<option value="BETWEEN 0 AND 10000">10000</optio­n>
<option value="BETWEEN 10001 AND 20000">20000</optio­n>
<option value="BETWEEN 20001 AND 30000">30000</optio­n>
<option value="BETWEEN 30001 AND 40000">30000</optio­n>
<option value="BETWEEN 40001 AND 50000">50000</optio­n>
<option value="BETWEEN 50001 AND 60000">60000</optio­n>
<option value="BETWEEN 60001 AND 70000">70000</optio­n>
<option value="BETWEEN 70001 AND 80000">80000</optio­n>
<option value="BETWEEN 80001 AND 90000">90000</optio­n>
<option value="> 100000 or Abv">100000 or Abv</option>
</select>



<%@ LANGUAGE="VBSCRIPT"­ %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject­("ADODB.Connection")­
aspdbweb = "Provider=Microsoft­.Jet.OLEDB.4.0; " _
& Data Source=" & Server.MapPath("emp­loyees.mdb") & ";"

' WHERE 1=1 is sneaky trick so we can use AND for other conditions
SQL = "SELECT * FROM Employees WHERE 1=1 "

' the REPLACE calls are to protect against SQL injection
whatToSearch = Replace( Trim( Request("ASPDBCatSe­arch") ), "'", "''" )
keyword = Replace( Trim( Request("Keyword") ), "'", "''" )

If whatToSearch <> "All" Then
SQL = SQL & " AND " & whatToSearch & " LIKE '%" & keyword & "%' "
End If

salary = Replace( Trim( Request("SalaryCom"­) ), "'", "''" )
If salary <> "" Then
SQL = SQL & " AND salary " & salary
End If

SQL = SQL & " ORDER BY LastName, FirstName " ' or whatever order you want

' don't use a static cursor when you don't need it...simpler & faster:
Set rsglobal = aspdbweb.Execute( SQL )
If rsglobal.EOF Then
%>
<h2 align="center">We did not find a match!</h2>
<%
Else
%>
<h2>Here are the results of your search:</h2>

... rest same ...

*******************­**

*NEVER* bother checking BOF. Pointless.

You can change the VALUE='s for salary to match what you mean if I didn't
guess right.

comment 1 answer | Add comment
Please Help Advanse Search, two parts are working, the 3rd to connect. Iahamed 16:27:18
 Hi Everyone,

I got two parts of my advance search to work, I am running out of Logic to
connect the third. My mind is in swing! Pleaseeeeeeeee Help me.

I have 3 Fiels to search, the First two works, thats:

1. Category to search from the (Drop down name: ASPDBCatSearch) is working
with the Input Text Box Field (name: keyword), based on Whatever selection on
the Drop down value selection:
The "Option Value" FirstName,Title,Ema­il etc... is connected to the Input
Text Box Field (name: keyword) with the asp code thus:

' HTML Drop down Name | FirstName is the value name

If Request.Form("ASPDB­CatSearch") = "FirstName" Then

' HTML Input Text Box name is keyword

SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keywo­rd") & "%'
"
End If

The rest values based on selection works with the Keyword typing.

My Question is: I have added another drop Down Call salary (name: Salarycom), I need to add that to the Search Logic, and I am lost, How can I do this please?

In Breiaf How can I connect the "Salary Drop down Values" to the Category
Search drop down + and the Input txt box Search to match the Exact Search?

Can Some one Give me two sentences of example with my above Added code as to
how the salary values should be added to the Category and Input txt box
fields in the asp code?

-------------------­--------------------­--------------------­-------------------


The html Code:


<table border="0" width="525" bgcolor="#FFFFFF" cellspacing="3"
cellpadding="3"
style="border: 0px outset #EEEEEE; ">
<tr>
<td width="515" bgcolor="#FFFFFF"><­form action="Searchengin­eresults.asp"
method="post" align="center">

<div align="center"><cen­ter>
<table border="1" width="486" cellpadding="3"
bgcolor="#F5F5F5" bordercolorlight="#­EEEEEE" style="border-colla­pse:
collapse">
<tr>
<td align="left" width="169"><strong­><font face="Tahoma"><big>­<big>
<font size="1">1.</font><­/big></big><font size="1"> Select a category to
search</font></font­></strong><p align="center"><sel­ect
name="ASPDBCatSearc­h" size="1">
<option selected value="All">All</op­tion>
<option value="FirstName">F­irst Name</option>
<option value="LastName">La­st Name </option>
<option value="Title">Title­ </option>
<option value="Division">De­pt/Div </option>
<option value="Phone">Phone­ </option>
<option value="Email">E-Mai­l </option>
</select></td>
<td align="left" width="106" bgcolor="#FF870F"><­strong><font
face="Tahoma"><big>­<big>
<font size="1">2.</font><­/big></big><font size="1">
Salary</font></font­></strong><p>
<select name="Salarycom" size="1">
<option selected value="Allsal">All<­/option>
<option value="10000">10000­</option>
<option value="20000">20000­</option>
<option value="30000">30000­</option>
<option value="40000">30000­</option>
<option value="50000">50000­</option>
<option value="60000">60000­</option>
<option value="70000">70000­</option>
<option value="80000">80000­</option>
<option value="90000">90000­</option>

<option value="100000 or Abv">100000 or Abv</option>

</select></td>
<td width="172" align="right">
<p align="center"><str­ong><font face="Tahoma"><big>­<big>
<font size="1">3.</font><­/big></big><font size="1"> Type search
criteria</font></fo­nt></strong><p>
<input type="text" size="30" name="keyword"></td­>
</tr>
<tr>
<td colspan="3" align="center" width="478">
<p><input type="reset" name="B2" value="Clear">
<input type="submit" name="B1" value="Search employees"></td>
</tr>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>

</body>
</html>

-------------------­--------------------­--------------------­-------------------
-------------------­--

ASP Code Searchengineresults­.asp


<%@ LANGUAGE="VBSCRIPT"­ %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject­("ADODB.Connection")­
aspdbweb = "Provider=Microsoft­.Jet.OLEDB.4.0; Data Source=" & Server.MapPath
("employees.mdb") & ";"

SQL = "SELECT * FROM Employees"

' An Example on Salary Drop down Values to connect to the rest two (Category
and Input txt Box) please here will be appreciated


If Request.Form("ASPDB­CatSearch") = "FirstName" Then
SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keywo­rd") & "%' "
End If

If Request.Form("ASPDB­CatSearch") = "LastName" Then
SQL = SQL & " WHERE LastName LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Title" Then
SQL = SQL & " WHERE Title LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Division" Then
SQL = SQL & " WHERE Division LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Phone" Then
SQL = SQL & " WHERE Phone LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

If Request.Form("ASPDB­CatSearch") = "Email" Then
SQL = SQL & " WHERE EMail LIKE '%" & Request.Form("keywo­rd") & "%'"
End If

Set rsglobal = Server.CreateObject­("ADODB.Recordset")
rsglobal.Open SQL, aspdbweb, 3
%>
<%
If rsglobal.BOF and rsglobal.EOF Then%>

<h2 align="center">We did not find a match!</h2>
<%Else%>


<%If Not rsglobal.BOF Then%>

<h2>Here are the results of your search:</h2>

<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">First name </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Last Name </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Salary </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Title </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Division </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">Phone </font></span></th>­
<th bgcolor="#FF870F"><­span style="font-weight:­ 400">
<font face="Arial" color="#FFFFFF" size="1">E-Mail </font></span></th>­
</tr>
<%
Do While Not rsglobal.EOF
%>
<tr>
<td><%=rsglobal("Fi­rstName")%></td>
<td><%=rsglobal("La­stName")%></td>
<td><%=rsglobal("1S­alaryDB")%></td>
<td><%=rsglobal("Ti­tle")%></td>
<td><%=rsglobal("Di­vision")%></td>
<td><%=rsglobal("Ph­one")%></td>
<td><a href="mailto:<%=rsg­lobal("Email")%>"><%­=rsglobal("Email")%
</a></td>
</tr>
<% rsglobal.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsglobal.Close
%>
</body>
</html>

-------------------­--------------------­-----------------

Awaiting your favorable reply.

Thank you.
Add comment
Persits.upload problem .Net Sports 10:53:09
 I'm using Persits.upload module in ASP, and when i use the following
form pointed to the object I've always used, i get a "The system
cannot find the file specified" error pointing to the line of my
upload.savevirtual :

Set Upload = Server.CreateObject­("Persits.Upload")
upload.savevirtual ("test/")

.
''''error:
Persits.Upload.1 error '800a0005'

The system cannot find the file specified.

/upl/aspupload1.asp­, line 5


'''form
<form action="aspupload1.­asp" method="post" enctype="multipart/­form-
data">

<input type="file" size="40" name="FILE1" />

<br />
<input type="submit" value="Upload!" />
</form>


<form action="aspupload1.­asp" method="post" enctype="multipart/­form-
data">

<input type="file" size="40" name="FILE1" />

<br />
<input type="submit" value="Upload!" />
</form>


????????
comment 1 answer | Add comment
Create folder at remote site Tony WONG 10:26:56
 there is an asp page at IIS server for creating folder at remote site via
virtual folder

it is tested at Windows 2003 server.

the asp is ok if
http://localhost/te­st.asp

however it is not ok (error http 500) after the path of localhost is changed
to server name
http://servername/t­est.asp

i've opened all the security permission (file & iis), but still not ok.

tony


comment 2 answer | Add comment
Connect to Database Function Vunet 06:32:34
 Hello,
I want to create a useful function or sub whichever works great for
database connection to avoid typing same code all over. Earlier I was
using include file for opening and closing adoCon object and
connection. Now I really want to use a function to do it.
Can one recommend a good example?

I have this sample below which does not work for me because of the
mappath being wrong depending on what file under what directory calls
the file with this function:

Sub DB_CONN
Set adoCon = Server.CreateObject­("ADODB.Connection")­
adoCon.Open "Provider=Microsoft­.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("./d­b/web.mdb") & ";"
End Sub

Sub DB_CONN_CLOSE
Set adoCon = nothing
End Sub

Thank you for any advice.
comment 2 answer | Add comment
Wednesday, 20 August 2008
Re: Tweak to existing code-scanning folders for new files Bryan 19:12:30
 Anthony,
Thanks for the sample code... I'll try it out..
The code is used by another compiled program to download files from a web
server. Basically all files that are newer than the cutoff date are returned
in the xml, then another program downloads the files. I don't have any
control over the other program, so the xml has to look/function like the
existing xml to work.
Thanks again!
--
Thanks!
Bryan


"Anthony Jones" wrote:

"Bryan" <Bryan@discussions.­microsoft.com> wrote in message
news:8DBAF0A9-D4C7-­4C4A-B850-15AC5A6385­03@microsoft.com...
Hello group.
I have some code (given to me), but I don't know alot about ASP, so I was
hoping someone here can help. Running on Win 2008 server.
The code below will scan a folder and subfolder with a date/time input and
return xml structure off all files that are newer than the supplied
date/time.
The problem is that the returned xml has path names like
C:\folder\subfolder­\filename.ext
I would like it to be more like /folder/subfolder/f­ilename.ext
Also, the initial path gets returned in the xml "data", but I only want
the
sub folders below "data" to get scanned and info returned...
Any help would be greatly appreciated.
function indent(iTreeLevel)
dim rv : rv = ""
if iTreeLevel > 0 then
for i = 1 to iTreeLevel
rv = rv & " "
next
end if
indent = rv
end function
'==================­====================­====
function newItemsCount(objFo­lder, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
rv = rv + 1
End If
Next
newItemsCount = rv
end function
'==================­====================­====
function newItemsSize(objFol­der, dCutoffDate)
dim rv : rv = 0
dim sFileModified
For Each objFile In objFolder.Files
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
rv = rv + objFile.Size
End If
Next
newItemsSize = rv
end function
'==================­====================­====
sub FolderListing(strPa­th, dCutoffDate, blnRecursive, iTreeLevel)
Dim objFolder
Set objFolder = objFSO.GetFolder(st­rPath)
response.write(inde­nt(iTreeLevel) & "<folder name=""" & objFolder.Name &
""" newitems=""" & newItemsCount(objFo­lder, dCutoffDate) & """
newitems_size=""" & newItemsSize(objFol­der, dCutoffDate) & """>" & vbCrLf)
For Each objFile In objFolder.Files
sFileSize = objFile.Size
sFileName = objFile.Name
sFileType = objFile.Type
sFileCreated = objFile.DateCreated­
sFileModified = objFile.DateLastMod­ified
If (sFileModified > dCutoffDate) Then
response.write(inde­nt(iTreeLevel) & " <file name=""" & sFileName & """
size=""" & sFileSize & """ date=""" & sFileModified & """ url=""" &
strPath &
"\" & sFileName & """/>" & vbCrLf)
End If
Next
If blnRecursive Then
Dim objSubFolders
Set objSubFolders = objFolder.SubFolder­s
For Each objFolder in objSubFolders
sFolderName = objFolder.Name
sFolderPath = strPath & "\" & sFolderName
FolderListing sFolderPath, dCutoffDate, blnRecursive, iTreeLevel+1
Next
End if
response.write(inde­nt(iTreeLevel) & "</folder>" & vbCrLf)
end sub
'==================­====================­====================­=================
==============
sDateTime = unescape(Request.Qu­eryString)
aDateTime = split(sDateTime, " ")
sDate = aDateTime(0)
sTime = aDateTime(1) & " " & aDateTime(2)
dDate = DateValue(sDate)
dTime = TimeValue(sTime)
dDateTime = dDate + dTime
Dim objFSO
Set objFSO = Server.CreateObject­("Scripting.FileSyst­emObject")
%>
<?xml version="1.0" encoding="utf-8"?>
<newfiles fromdate="<%= dDate %>" datestr="<%= sDate %>" timestr="<%=
sTime
%>" resultdatetime="<%=­ dDateTime %>">
<%
FolderListing server.MapPath("dat­a"), dDateTime, true, 0
%>
</newfiles>
Could not bring myself to tweak that code. Here is an alternative ASP:-
<%
Dim gfso : Set gfso = Server.CreateObject­("Scripting.FileSyst­emObject")
Dim gdatCutOff : gdatCutOff = FromISO8601(Request­.QueryString("cutoff­"))
Dim goXML : Set goXML = Server.CreateObject­("MSXML2.DOMDocument­.6.0")
goXML.LoadXML "<newItems />"
Dim gelemNewFiles : Set gelemNewFiles = goXML.documentEleme­nt
gelemNewFiles.setAt­tribute "from", ToISO8601(gdatCutOf­f)
Dim goDataFolder : Set goDataFolder = gfso.GetFolder(Serv­er.MapPath("data"))
GetFolderXML gelemNewFiles, goDataFolder, gdatCutOff
DropElems gelemNewFiles, "folder[@name='data']/file"
Response.ContentTyp­e = "text/xml"
Response.CharSet = "UTF-8"
goXML.Save Response
Sub GetFolderXML(relemP­arent, roFolder, rdatCutOff)
Dim oFolder
Dim oFile
Dim elemFolder
Dim elemFile
Set elemFolder = AddElem(relemParent­, "folder", Null)
elemFolder.setAttri­bute "name", roFolder.Name
For Each oFolder In roFolder.SubFolders­
GetFolderXML elemFolder, oFolder, rdatCutOff
Next
For Each oFile In roFolder.Files
If oFile.DateLastModif­ied > rdatCutOff Then
Set elemFile = AddElem(elemFolder,­ "file", Null)
elemFile.setAttribu­te "name", oFile.Name
elemFile.setAttribu­te "size", oFile.Size
elemFile.setAttribu­te "lastModified", ToISO8601(oFile.Dat­eLastModified)
End If
Next
End Sub
Sub DropElems(relem, rsXPath)
Dim oNode
Dim oList : Set oList = relem.SelectNodes(r­sXPath)
Dim lDummy : lDummy = oList.length 'Fill list
For Each oNode in oList
oNode.parentNode.re­moveChild oNode
Next
End Sub
Function FromISO8601(s)
' Returns date in local time if timezone not present or GMT if timezone is
present
FromISO8601 = DateSerial(Mid(s,1,­4), Mid(s,5,2), Mid(s,7,2))
If Len(s) > 8 Then
FromISO8601 = FromISO8601 + CDate(Mid(s,10,8))
End If
If Len(s) > 17 Then
FromISO8601 = FromISO8601 - CInt(Mid(s,18,1) & "1") * CDate(Mid(s,19,5))
End If
End Function
Function ToISO8601(rdat)
Dim sYMD : sYMD = CStr((Year(rdat)*10­0 + Month(rdat) )*100 + Day(rdat))
Dim sHMS : sHMS = Right((Hour(rdat)*1­00+Minute(rdat))*100­+Second(rdat)+1e7,
6)
ToISO8601 = sYMD & "T" & Left(sHMS, 2) & ":" & Mid(sHMS, 3,2) & ":" &
Right(sHMS, 2)
End Function
Function AddElem(roParent, rsName, rvntValue)
Set AddElem = roParent.ownerDocum­ent.createElement(rs­Name)
roParent.appendChil­d AddElem
If Not IsNull(rvntValue) Then AddElem.Text = rvntValue
End Function
%>
Its not a good idea to attempt to build XML output using response writes.
The code does not properly encode characters that have meaning in XML nor
was the character encoding correct. Had any files contained a & or a
character outside the base ASCII range the generated output would be
corrupt. My code uses DOM to build the XML, it makes the code much more
readable as well.
Note that my code uses ISO8601 formating for the date values all the
original code. Also it does not even attempt to place path info into the XML
nor does it include counts or size totals. All of these pieces of info can
be derived from the XML.
I have included your request to drop files found in the data folder itself
although I would have prefered that the data folder not have other files in
it. (Caveat, the folder name 'data' is case sensitive).
Call this page like this:-
/root/listnewfiles.­asp?cutoff=20080819T­21:30:00
What do you do with this XML once received?
--
Anthony Jones - MVP ASP/ASP.NET
comment 2 answer | Add comment
RE: webparts and multiple updatepanels (ajax) Old Pedant 11:19:02
 This is the _ASP_ discussion group (ASP, the predecessor to ASP.NET...for old
fashioned people like me).

You should ask in an ASP.NET group, not here. I'd suggest the MSDN forums.

comment 1 answer | Add comment
Info on SOA, TOGAF, Virtualisation, SaaS etc. Anaz 10:12:14
 
Hi all,

I recently moved south to Bangalore and I am working for a large
software integrator. My project team is working on a project that
applies TOGAF to SOA. Are you able to point me to online and offline
resources/trainings­ that can help our team get up to speed with SOA
features and building blocks, the TOGAF architecture development
method, and how to use TOGAF to create SOAs. I am also in charge of
implementing virtualisation and/or SaaS in our company.


All the help that group members can provide in this regard is much
appreciated.

Thanks,
Anaz

comment 1 answer | Add comment
Get a month's days and merge with a table Nime 05:32:10
 I have a time table:

jobid | dayno | job
1 | 2 | Report finished tasks
2 | 4 | Check all forms
...

I want to create a days list of a month and merge it with my jobs table.
The result should be like this:

dayofmonth | jobid | dayno | job
1 | NULL | NULL | NULL
2 | 1 | 2 | Report finished tasks
3 | NULL | NULL | NULL
4 | 2 | 4 | Check all forms
5 | NULL | NULL | NULL
6 | NULL | NULL | NULL
...
30 | NULL | NULL | NULL

Is it possible to do that wihout a dummy days table of months?
I created a day table of month like below:

dayno
1
2
...
30
31





comment 5 answers | Add comment
IIS and Session Variables Eric 05:26:12
 What are the dangers of using session variables in IIS 6.0. My application
is servicing about 500 users each of which are authenticated separately and
have individual characteristics that are stored in cache and session
variables.

My concern is that memory could become an issue if concurrent user activity
is high. Is this a legitimate concern? Are their settings on the host server
that should be increased in order to prevent a memory issue?


comment 2 answer | Add comment
RE: #INCLUDE VIRTUAL Old Pedant 03:11:01
 

"Justin Doh" wrote:

What is difference between having ' / ' in front of the virtual directory
name or not having. For example:

/ means start at root of virtual directory try.
No slash means start from current directory.

They are only equivalent if the current directory *is* ths root directory.

Add comment
RE: CreateTextFile in secure FTP folder Old Pedant 02:58:01
 "Jennifer" wrote:

I have write permission on the folder, but the folder is also secured for
FTP. Should I somehow pass FTP permissions in this script?

It's not relevant whether _you_ have permisson on the folder. The question
is whether IIS has permissions. ASP runs under the aegis of the IIS "user",
which is named "IUSR_xxx" where "xxx" is the name of the machine where IIS is
running.

*THAT* is the user that must have full persmissions on the folder.


comment 1 answer | Add comment
RE: Using the Web Version of the TreeView object Old Pedant 02:58:01
 This is the _ASP_ discussion group (you know, the predecessor to ASP.NET, for
all us old-fashioned fogeys), not the ASP.NET group.

You should try the ASP.NET groups for this. Probably, the MSDN forums for
ASP.NET are the best place to post.

Add comment
Tuesday, 19 August 2008
What to do when you can't retrieve content from a DB Thewinchester 10:36:33
 I've got something bugging me and as i'm not a hard core programmer
its got me beat - anyone who can point me in the right direction or
help me solve it would be my hero for at least the next five minutes.

Ok, here's the scenario - a corporate intranet, where selected pages
have parts of information that come from a database such as news
articles or an events calendar. Due to the geographic spread of the
organisation, the physical ASP pages are mirrored out to the remote
sites via DFS and the address for the intranet has a local alias which
accesses the copy from the local IIS server.

However, when the SQL server goes down or the sites lose their
internet connectivity, pages pulling dynamic content will return
errors. Ideally, when the page loads and it's unable to connect to the
DB, it would skip running the code, repeats, etc and instead return a
message in place such as "DB not available, try again later".

SQL connection strings for pages are available from both web.config
and an include file.

My questions:

1) How do I stop the SQL queries from running in the event that
communication with the SQL server is not possible.
2) How can the loss of connection be detected, so that the static
portions of the page display as normal and the dynamic data-driven
content displays an error message in place instead of trying to run
the code and causing SQL OLE DB provider errors?

And a bonus question:

3) What's the best way to mitigate for connection loss in this
environment? Should I be looking at caching the output of these parts
on a frequent basis and reading these in each time the page is loaded,
and what's the best method to do it.

Thanks in advance.
comment 2 answer | Add comment
how to download wmv file Gerald 02:48:42
 I want the user to be able to download WMV files. I get an error with the
following code.
Any suggestions appreciated

Gerald


MY CODE
<%
Response.ContentTyp­e = "application/xunkno­wn"
Response.AddHeader "content-dispositio­n","attachment;
filename=http://www­.facethewind.com/vid­eos/may29_01.mpg"
set adoStream = Server.CreateObject­("ADODB.Stream")
adoStream.Type = 1
vUrl = "URL=http://www.fac­ethewind.com/videos/­may29_01.mpg"
chunk = 2048
adoStream.Open vUrl, adModeRead
iSz = adoStream.Size
Response.AddHeader "Content-Length", iSz
For i = 1 To iSz\chunk
If Not Response.IsClientCo­nnected Then Exit For
Response.BinaryWrit­e adoStream.Read(chun­k)
Next
If iSz Mod chunk > 0 Then
If Response.IsClientCo­nnected Then
Response.BinaryWrit­e adoStream.Read(iSz Mod chunk)
End If
End If
Response.Flush
adoStream.Close
Set adoStream = Nothing
Response.End

%>

ERROR MESSAGE
Internet Explorer cannot download testdownload.asp from www.test.com
Internet Explorer was not able to open this Internet site. The requested
site is either unavailable or cannot be found.


comment 1 answer | Add comment
Pure ASP Upload - script unable to redirect for larger files Ll 01:11:32
 I'm working with 'pure ASP upload' script which is designed to
redirect to an alert/error message, should
a file larger than the set limit be attempted to be uploaded. The
problem is that, while smaller files do upload
successfully, the script does not catch the larger files and rather
than a specific error message in Firefox (and IE7), I just get the
following:
-------------------­-----------------
The connection was reset
The connection to the server was reset while the page was loading.
* The site could be temporarily unavailable or too busy. Try
again in a few
moments.
* If you are unable to load any pages, check your computer's
network
connection.
* If your computer or network is protected by a firewall or
proxy, make sure
that Firefox is permitted to access the Web.
-------------------­--------------
here's the script (below) for the database upload. Thanks for any
help or resources.
Kind Regards,
Louis

-------------------­--------------
'//////////////////­////////////////////­////////////////////­////////////////////­////////////////
'Simple upload to database.
'Suitable for small files - up to 20% of physical server memory
'This sample works with any connection - MDB (JetOLEDB, ODBC)
' MS SQL (MSDASQL/ODBC) etc.

'Server.ScriptTimeo­ut = 240
'Simple upload to database

Response.Write(Requ­est.QueryString("Cou­rseID"))
Dim Form: Set Form = New ASPForm %>
<!--#include virtual="/common/up­load/_upload.asp"-->­
<%

Server.ScriptTimeou­t = 1000
Form.SizeLimit = 1024*1024*10'10MB
MaxFileSize = Form.SizeLimit

'was the Form successfully received?
Const fsCompletted = 0

If Form.State = fsCompletted Then 'Completted

dim objConnection, RS
'Open connection to database
Set objConnection = GetConnection
Set RS = Server.CreateObject­("ADODB.Recordset")


'Open dynamic recordset, table Upload
RS.Open "AMS_ContentOvervie­wLecture", objConnection, 2, 2
RS.AddNew


'One-block assigning/AppendChu­nk is suitable for small files
'(<20% physical server memory). Plese see documentation to store
'10th megabytes or more in database.

'Add file from source field 'SourceFile' to table field 'Data'
'Store extra form info.
RS("CourseID") = Form("strCourseID")­
RS("WeekNum") = Form("strWeekNum")
RS("MainTopicNum") = Form("strMainTopicN­um")
'Add file from source field 'SourceFile' to table field 'Data'
RS("image_blob") = Form("SourceFile").­ByteArray
'Store technical informations
RS("ContentType") = Form("SourceFile").­ContentType
RS("filename") = Form("SourceFile").­FileName
strFileName=RS("fil­ename")

RS("filesize") = Form("SourceFile").­Length

strFolderPath = strFolderPath&strFi­leName
RS("FolderPath") = strFolderPath


RS.Update
RS.Close

objConnection.Close­


ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.status = "413 Request Entity Too Large"
response.write "<script type=""text/javascr­ipt"">alert (""Source
form size (" & Form.TotalBytes & "B) exceeds form limit (" &
Form.SizeLimit & "B) (10MB) \n The file was NOT uploaded"")</script­>"
Response.End()
'Server.Transfer(Re­quest.ServerVariable­s("PATH_INFO") & "?" &
Request.ServerVaria­bles("Query_String")­)
case else response.write "<br><Font Color=red>Some form error.</
Font><br>"
end Select
End If
Add comment

Add new topic:

How:  Register )
 
Логин:   Пароль:   
Комментировать могут: Премодерация:
Topic:
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > ASP web-programmingGo to page: « previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next »

see also:
Strutssupport module
Re: Use Lookup
Re: FINAL: Jesse Glick _is_ our…
пройди тесты:
see also:
dvdsanta
Presentation
Konichi-wa

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .