Jump to content

kwilliams

Members
  • Posts

    229
  • Joined

  • Last visited

Everything posted by kwilliams

  1. I have 2 questions:1) I've read that the ASP.NET SessionID is 120-bit, and I know that our old ASP SessionID's were about 24 characters long. So can the new ASP.NET SessionID's be up to 120 characters long?2) I'm still having a problem with a new ASP.NET site that I'm developing with the use of Session variables. I set the main "Session.Timeout = 20" and the "SessionID" on the login page's bacground script page, but the user's session is timing out even though there is activity across related pages on one site. All of the pages are located across different directories within one site on one server. But all of the site's pages are accessed through one central page dynamically through server-side includes. Does anyone know why this is happening? Could it be because the site's dynamic? And if so, how can I get this to work with a dynamic site?Thanks for any help.
  2. I'm trying to use session variables throughout a new dynamic site that I've created, but I'm running into problems with the session var's timing out even though there is activity by the user.These are the basic steps that are involved with the sessions:1) The user logs in with a username & password that must match a DB record (level1.aspx). This form's submittal redirects the user's browser to a background script page (bgscript.aspx).2) If user is valid, SessionID is set for user on the background script page, like this:Dim strSessionID As String = Session.SessionIDSession("SessionID") = strSessionIDThen the user is then redirected to the dynamic main page for the site (level2.aspx).3) On level2.aspx, the Session.Timeout is set for 40 minutes. All pages are accessed dynamically from this page through SSI's. If the user's SessionID is empty, then they're redirected like this:If Session("SessionID") = "" Then Response.Redirect("logoff.aspx?timeout=true")End IfThe problem is that while the user browses the pages dynamically through the level2.aspx main page, the sessions all timeout after 20 minutes even though the user is active.Could this be happening because I'm setting the SessionID on the bgscript.aspx page vs. the level2.aspx page? (Note: I'm doing that because the SessionID is inserted into a DB table on this same bgscript.aspx page) Shouldn't session variables pass between any pages on a site as long as the browser window is open? I'd really appreciate any help. Thanks.
  3. I'm developing my site with ASP.NET with the use of Web Matrix/Notepad. I'm using VB syntax. We would like to call an executable file on a webpage for an on-the-fly photo.Basically, we have photo paths stored in our DB table, and the actual photos are stored outside of a database. We currently have an executable job that optimizes the photo, and adds a label before it's viewed by the user. This is currently all done in ASP statically.But we'd like to create a function that will do the following:1) Pull the path from the DB2) Save that photo to a temp folder3) Run an executable file against that photo4) Display the optimized photo for the user onlineWe have everything set up except for the calling of the executable file. So how can I call an executable file from a function within ASP.NET? And how could I then call that function from the actual web page display? Any and all help would be great. Thanks.
  4. Is there a way with CSS2 Print to specify a line break after a certain amount of rows in a data table on a regular web page? Thanks for any help.
  5. I'm new to this, so please bear with me. I'm trying to use the FormatCurrency Function to format a number located in a SQL Server 2k DB table. But I'm having a problem in defining the rules for the number. Basically, the number in the DB is "180792" (without quotes), and I want it transfered to "$1807.92". But my setup of this method is returning "$180,792".Here's more details on what I'm using, and what I'm trying to do:ORIGINAL DB VALUE:180792CURRENT CODE:Dim strNumber As String = Trim(rsQuery("Number").Value.ToString)strNumber = (FormatCurrency(strNumber,0))CURRENT RESULT:$180,792WANTED RESULT:$1,807.92I hope that someone can help me out with this one. I'm just not sure if this method has too many limitations that I can't use, or if I'm just not adding another few steps. Any and all help is appreciated. Thanks.
  6. I'm having a strange problem with what should be a simple query. First off, I'm using a front-end web application to query a SQL Server 2k table with a stored procedure. All of the other SP's are working fine, but this one uses the LIKE operator, which is giving me strange results.With the code included below, I get no results on the display page. With testing I know that the @User variable is being passed properly, and I know that the SP is being called properly, but no results are showing up. I think that it might have to do with my use of the LIKE operator with the web page's form variable, but I'm not sure. So that's why I'm here. Here's the code:ASP.NET FRONT-END <%'Declare variablesDim strSubmitForm As String = Server.HTMLEncode(Left(Trim(Request.Form("hfSubmitForm")), 5))Dim strFName_txt As String = Server.HTMLEncode(Ucase(Left(Trim(Request.Form("txtFName")), 45)))Dim strLName_txt As String = Server.HTMLEncode(Ucase(Left(Trim(Request.Form("txtLName")), 45)))Dim strSearchYear As String = "2006"Dim intRecordCount As Integer = 0'Remove apostrophesstrFName_txt = Replace(strFName_txt, "'", "''")strLName_txt = Replace(strLName_txt, "'", "''")'Assign combo variableIf strFName_txt = "" Then 'Assign first name only strUserCombo = strLName_txtElse 'Assign first and last name strUserCombo = strLName_txt + " " + strFName_txtEnd If%><%'Display query formResponse.Write("<form id='searchFilter' name='searchFilter' method='post'>")Response.Write("<table>")Response.Write("<tr>")Response.Write("<td bgcolor='#ccccff' valign='top'>")Response.Write("<strong>User:</strong>")Response.Write("</td>")Response.Write("<td>")Response.Write("First Name: <input type='text' id='txtFName' name='txtFName' value='' size='30' maxlength='45' />")Response.Write(" ") 'spacerResponse.Write("Last Name: <input type='text' id='txtLName' name='txtLName' value='' size='30' maxlength='45' />")Response.Write("<input type='hidden' id='hfSubmitForm' name='hfSubmitForm' value='True' />")Response.Write("</td>")Response.Write("</tr>")Response.Write("</table>")Response.Write("</form>")%><%If strSubmitForm = "True" Then 'Display results table Response.Write("<table>") Response.Write("<td>First Name</td>") Response.Write("<td>Last Name</td>") '------------------Query Begins----------------------- Dim sqlQuery As Object, rsQuery As Object objConn = Server.CreateObject("ADODB.Connection") objConn.Open (strConnLandUse) sqlQuery = "spUser @User = '" & strUserCombo & "', @Year = '" & strSearchYear & "'" rsQuery = objConn.Execute(sqlQuery) 'If RS is not empty Do While NOT rsQuery.EOF 'Record count intRecordCount = intRecordCount + 1 If intRecordCount >= 500 Then Exit Do 'Exit from infinite loop If intRecordCount <= 200 Then 'Display results (under 200 records) Response.Write("<tr>") Response.Write("<td>" & rsQuery("FName").Value & "</td>") Response.Write("<td>" & rsQuery("LName").Value & "</td>") Response.Write("</tr>") End If rsQuery.MoveNext Loop sqlQuery = nothing rsQuery = nothing objConn.Close objConn = nothing '------------------Query Ends------------------------- Response.Write("</table>")End If%> SQL SERVER BACK-END - TABLE (tblUser)ID Name1 DOE JOHN2 DOE JANE3 SCHMO JOHNSQL SERVER BACK-END - STORED PROCEDURECREATE PROCEDURE [dbo].[spUser]@User char (45),@Year char (4)ASSET NOCOUNT ONSELECT * FROM tblUserWHERE User LIKE '%' + @User + '%' AND ([Year] = @Year)ORDER BY ID ASCSET NOCOUNT OFFGOWhen I change the SP from:WHERE User LIKE '%' + @User + '%' AND ([Year] = @Year)to:WHERE User LIKE '%DOE JANE%' AND ([Year] = @Year)or:WHERE User LIKE '%' + 'DOE JANE' + '%' AND ([Year] = @Year)...I do get the proper results. Also, if I move the wildcards to the webpage, like this:sqlQuery = "spUser @User = '%" & strUserCombo & "%', @Year = '" & strSearchYear & "'"...and I then remove the wildcards from the SP, like this:WHERE User LIKE @User AND ([Year] = @Year)...I get the first record from the table. Of course, I can't use the LIKE operator when declaring the SP's variables, so I can't use this as a solution.So if anyone sees what I'm doing wrong, and can steer me towards the light, I'd be greatly appreciated. Thanks for any help.
  7. I have pure CSS menus for our site, and they work great. But they don't load in front of the form fields on the page. My old JavaScript menu did the same thing. I remember asking about this a few years ago, and I also remember someone saying that it's because since the CSS and JavaScript load before the HTML on a web page, they have priority in the scheme of things. Am I correct, or is there another reason for this? Also, is there a fix for this somewhere, or is it not possible to fix? Thanks for any clarification.
  8. I'm going to be generating a SessionID for each user on my main application, so that it can be transfered across other sub-applications. I'm also going to be inputing it into an authentification DB table when the user logs in, along with their AccountID and the current DateTime.But I'm new to SessionID's and I have few questions:1) How long can a SessionID end up being?2) How long are they stored for?3) If a user closes their browser, reopens it, and logs in again, will they have a new SessionID or the same one? (Note: I tried it out, and it stayed the same. But I'm not sure if that's how it's supposed to work.)4) I've heard that a SessionID can end up not being unique. Is this true?5) What are the benefits of using a SessionID instead of an already existing AccountID for each user. (Note: Each Account ID is a unique ID stored in the main accounts DB table).Ok, that's it. Thanks for any help.
  9. Ok, I received the solution from another forum. You can see the thread at http://www.webdeveloper.com/forum/showthre...9466#post559466. This is the solution: And it now works, as you can see on the test page. Thanks to everyone for their help:)
  10. P.S. I've now actually added the CSS to the page with an actual horizontal rule. I had just intended for people to see what I was seeing, but now I understand that you can't help without all of the information. Thought that I'd beat you to the punch:)
  11. I'm having a problem yet again with how CSS2 is rendered in IE. This time, I'm trying to create a customized horizontal rule. It works great in Firefox, but not in IE. It shows up with some sort of border/indentation in IE, even thought the border is set to 0px. I've created a test page at http://www.douglas-county.com/testhr.asp that shows exactly what I'm seeing in IE.If anyone knows whether or not there is a solution to this, I'd really appreciate hearing it. Thanks for any help.
  12. Ok, with the help of Fang on another forum (see http://www.webdeveloper.com/forum/showthread.php?p=551558), I was able to come up with another solution. But I'm still running into one of the same problems. The arrow background image for the list-items that contain a sub-menu is not working properly in IE6, but it works fine in all other browsers. It basically reloads the arrows image each time a user hovers over the list-item that contains one. You can see this on a test page at http://www.douglas-county.com/suckertest.asp. You can view all of the code, including the CSS stylesheet, by viewing the source code.If anyone knows of how/if I can get this to work, that would be great. Thanks.
  13. Hi real_illusions,Thanks for the reply. IE does support some of CSS2, but does not support the :hover method properly. So developers are having to resort to IE hacks to get it working properly in IE, because it sucks (in my own personal opinion).I believe that I've come up with another possible solution. I think that the problem I was having with the .htc file was that it was located within the CSS stylesheet using the behavior: url method. I think that was loading the .htc file for each list-item in IE, like this:div#nav1 li { /* Main List Properties */behavior: url(/scriptlibrary/iefixes.htc);...}...which was causing the problem.So I think that if I remove the .htc from the CSS file, and include it on the correct section of the HTML page, it will work properly in IE. I found an article (http://www.howtocreate.co.uk/tutorials/testMenu.html) that tells you to place the .htc file within the (X)HTML, but it's still not working for me in IE. If anyone has any advice on this idea, it would be greatly appreciated. Thanks.
  14. I've continued to have this problem with our old site, which is live until we get our new site out. Basically, our site loads fine in Firefox, but very slowly in IE6. I think it's because of an extra .hta file that exists to make the CSS popups with in IE. So now I'm trying to get rid of that file, and use the CSS :hover fix noted on several articles (Ex: http://www.tanfa.co.uk/css/articles/pure-css-popups-bug.asp and http://www.quirksmode.org/css/ie6_purecsspopups.html).Here's what I have:With .hta file:http://www.douglas-county.com/Without .hta file:http://www.douglas-county.com/index_wohta.aspCSS stylesheet: /*Page Properties*/.noPrint { display: none; } body { font-family: arial, sans-serif; background-color:#FFF; margin-top:0; margin-left:0; margin-bottom:0; margin-right:0; color:#000000;}a { background: transparent; font-family: arial, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: underline;}a:link,a:visited { color: #306;}a:hover { color: #F00; text-decoration: none; border: none;}a:active { color: #306;}a.small { background: transparent; font-family: arial, sans-serif; font-size: 10px; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: underline;}a.small:link,a.small:visited { color: #306;}a.small:hover { color: #F00; text-decoration: none; border:none;}a.small:active { color: #306;}p { font-size:12px; font-style:normal; letter-spacing:normal; text-decoration:none; color:#000;}p.small { font-size:10px;}p.red { font-size:10px; color:#F00;}div { font-family: arial, sans-serif; font-style:normal; letter-spacing:normal; text-decoration:none; color:#000;}div.small { font-size:10px;}div.red { font-size:10px; color:#F00;}td { font-size:12px; font-style:normal; letter-spacing:normal; text-decoration:none;}td.small { font-size:10px;}td.topback2 { background-image:url(../images/topback2.gif)}td.btmlines2 { background-image:url(../images/btmlines2.gif)}table { font-family: arial, sans-serif;}/* Light blue-gray border */table.bluegrayborder, table.bluegrayborder td { border-width:1px; border-style:solid; border-color:#CCC;}/* Medium blue border */table.medblueborder, table.medblueborder td { border-width:1px; border-style:solid; border-color:#66C;}/* Dark blue border */table.darkblueborder, table.darkblueborder td { border-width:1px; border-style:solid; border-color:#306;}/* Maroon border */table.maroonborder, table.maroonborder td { border-width:1px; border-style:solid; border-color:#600;}/* Black border */table.blackborder, table.blackborder td { border-width:1px; border-style:solid; border-color:#000;}/* White border */table.whiteborder, table.whiteborder td { border-width:1px; border-style:solid; border-color:#FFF;}/* Cream border */table.creamborder, table.creamborder td { border-width:1px; border-style:solid; border-color:#FFC;}li { font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-decoration:none; color:#000000;}li.square { list-style-type: square; list-style-position:inside;}h1, h2, h3, h4, h5, h6 { display:inline; font-style:normal; font-weight:bold; letter-spacing:normal; text-decoration:none;}h1 { font-size:16px; color:#600;}h2 { font-size:14px; color:#000;}h3 { font-size:12px; color:#FFF;}h4 { font-size:10px; color:#F00;}/*Form Properties*/form { color:#000; font-size: 12px;}.formButton { background-color:#ccc; font-size: 8pt; font-weight: bold; width: auto; height: 20px; padding: 0px 0px; margin: 1px; text-align: center; cursor:pointer; border-color:#336;}input, textarea { padding: 1px; background-color:#FFF; border: inset 2px #600;}.blueform { padding: 1px; background-color:#FFF; border: inset 2px #336;}/*Navigation Properties*/div#nav1 { /* Main Nav Properties */ border: 1px solid #306; background: #FFFFCC; font-family: arial,sans-serif; font-size: 10px;}div#nav1 ul { /* Main Nav Unordered List Properties */ display: block; margin: 0px; padding: 0px; font-family: arial,sans-serif; font-size: 10px;}div#nav1 li { /* Main List Properties */ display: block; list-style: inline; line-height: 1.5em; font-family: arial,sans-serif; font-size: 10px;}div#nav1 li:hover, div#nav1 li.hover { /* List Hover Properties */ background: #CCCCFF; display: inline; border-width:1px; text-decoration: none;}div#nav1 ul.sub1 { /* Nav Unordered List 'Sub1' Properties */ position: absolute; border: 1px solid #330066; padding: 0px; background: #FFFFCC; margin: 0px 0px 0px -1px; width: 90px; /* MUST BE HERE FOR NS TO WORK*/ display: none;}div#nav1 ul.sub2 { /* Nav Unordered List 'Sub2' Properties */ position: absolute; border: 1px solid #330066; padding: 0px; background: #FFFFCC; margin: -16px 0px 0px 90px; width: 90px; /* MUST BE HERE FOR NS TO WORK*/ display: none;}div#nav1 ul.sub3 { /* Nav Unordered List 'Sub3' Properties */ position: absolute; border: 1px solid #330066; padding: 0px; background: #FFFFCC; margin: -16px 0px 0px 90px; width: 90px; /* MUST BE HERE FOR NS TO WORK */ display: none;}div#nav1 li>ul.sub1 { /* Nav <LI> to <UL> 'Sub1' Properties */ margin: 0em 0px 0px 0em;} div#nav1 li>ul.sub2 { /* Nav <LI> to <UL> 'Sub2' Properties */ margin: -1.5em 0px 0px 90px; /* NS */}div#nav1 li>ul.sub3 { /* Nav <LI> to <UL> 'Sub3' Properties */ margin: -1.5em 0px 0px 90px; /* IE */}div#nav1 ul.root li:hover ul.sub1, div#nav1 ul.root li.hover ul.sub1 { display: block; border-width:1px; text-decoration: none;}div#nav1 ul.sub1 li:hover ul.sub2, div#nav1 ul.sub1 li.hover ul.sub2 { display: block; border-width:1px; text-decoration: none;}div#nav1 ul.sub2 li:hover ul.sub3, div#nav1 ul.sub2 li.hover ul.sub3 { display: block; border-width:1px; text-decoration: none;}div#nav1 a { /* IE */ color: #330066; text-decoration: none; line-height: 1.5em; display: block; width: 90px; height: auto; font-family: arial,sans-serif; font-size: 10px;}div#nav1 a:hover,div#nav1 a.hover { color: #330066; background: #CCF; display: block; width: 90px; border-width:1px; text-decoration: none;}.hassub3 { background: url('arrows.gif') no-repeat right center;} I've followed the instructions in both articles by adding text-decoration:none; and border:none; properties to all of the :hover properties, but it's still not working for me in IE6. So if anyone could let me know what I'm doing wrong, that would be great. Thanks for any help.
  15. I'm pretty much a newbie when it comes to stored procedures and ASP.NET, but I'm wanting to convert all of my recordsets to stored procedures throughout my site. I'm running into trouble with what should be a simple stored procedure.This is what I classically would have done using a recordset: <%Response.Buffer = True'Declare form variablesDim strUsername As Object = trim(Request.Form("txtUsername"))Dim strPassword As Object = trim(Request.Form("txtPassword"))'RecordsetDim objConn As Object, rsAccounts As ObjectobjConn = Server.CreateObject("ADODB.Connection")objConn.Open (strConnAccounts)rsAccounts = "SELECT * FROM tblAccounts WHERE Username = '" & strUsername & "' AND Password = '" & strPassword & "'"rsAccounts = objConn.Execute(rsAccounts)objConn.ClosersAccounts = nothingobjConn = nothing'Test outputResponse.Write("FName: " & rsAccounts("FName") & "<br />")Response.Write("LName: " & rsAccounts("LName") & "<br />")%> How can I accomplish this with using a Stored Procedure? I don't understand how I can use variables within an ASP.NET page within a Stored Procedure's WHERE clause. Thanks for any help.
  16. kwilliams

    ASP.NET and SSI

    This is what I'm trying to setup:page1.aspx<%'Declare main form variableDim page_id As String = "login" 'Static test variable'Dim page_id As String = trim(Request.Form("page_id")) 'Dynamic variable to be used%><%'***LOGIN PAGE***If page_id = "login" Then%><!--#include virtual="login.aspx" --><%End If%>page2.aspx<%'Declare variables'Dim page_title As StringDim page_description As StringDim page_content As String'Response.Write("test") 'TEST'Page titleDim page_title As String = "Login Page"'Page descriptionpage_description = "This is the login page."'Page contentpage_content = "This the content for the login page."%>page3.aspx<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" aspcompat="true" Debug="true" %><%<%Response.Write("<title>" + page_title + "</title>")%>Resulting ErrorCompilation ErrorCompiler Error Message: BC30451: Name 'page_title' is not declared....and when I add <% Response.Write("test") %> to page2.aspx, and comment out the <% Response.Write("<title>" + page_title + "</title>") %>, I don't receive that error and the "test" does get written out. So I know that the page setup is working. I'm just not sure why the last display page (page3.aspx) is not seeing the variable from the SSI.I'm using this setup so that I can have one SSI that contains other SSI's that actually contain each page's data. I'll then pull each of the page's data using <%Dim page_id As String = trim(Request.Form("page_id"))%> on page1.aspx.If anyone could let me know what I'm doing wrong, it would be great. Thanks.
  17. Hello all,I'm having a strange problem with our intranet sharepoint alias/redirect. When I type in "http://intranet" or "intranet" into any browser, I get redirected to different pages or sites depending on the browser. This is what happened with a test of several browsers:Firefox 1.8:http://intranet - redirected to http://www.intranetjournal.com/intranet - SAMENetscape 8.0http://intranet - redirected to http://search.netcenter.netscape.com/nctr/...&query=intranetintranet - SAMEIE 6.0http://intranet - Cannot find server: The page cannot be displayedintranet - redirected to http://search.msn.com/results.aspx?srch=10...=AS5&q=intranetOpera 8.0http://intranet - redirected to http://www.intranet.com/intranet - SAMESo as you can see, there is some problem with the alias/redirect that was set up for our intranet site. But so far, this is only happening on my machine. I realize that it's not a browser issue but an intranet sharepoint issue, but I'm not sure what to do. If anyone knows what's going on, and how I can fix it, I'd love to know. Thanks for any help.
  18. I'm using JavaScript set the disable property on a textbox if a checkbox is selected, like this:<input type="checkbox" name="cbquestion1" id="cbquestion1" onclick="java script:document.form1.txtanswer1.disabled=false">What is the name of your favorite pet?</input><input type="text" id="txtanswer1" name="txtanswer1" value="" size="20" maxlength="20" disabled="true" />It works great, but now I'd like to add a behavior will basically do the opposite so that if the checkbox is then de-selected after initially being selected, it will re-disable the textbox. If anyone knows how to do this, I'd greatly appreciate the help. Thanks.
  19. I decided that it would be smart to replace any apostrophe's with a question mark anyway for future use, so I just added a replace function like this:lname_form = lname_form.replace("'","?")...and I'll then change it back when displaying the data on a web page or email. Now I'm good-to-go. Thanks:)
  20. I'm new to using Regular Expressions, but I'm trying to use them for form validation. Everything's going fine so far, except for names that contain an apostrophe (i.e. O'Dell).This article http://msdn.microsoft.com/library/default....paght000001.asp, states that this code:Regex.IsMatch(fname_form, "^[a-zA-Z'.\s]{1,40}$")"...constrains an input name field to alphabetic characters (lowercase and uppercase), space characters, the single quotation mark (or apostrophe) for names such as O'Dell, and the period or dot character. In addition, the field length is constrained to 40 characters.".But I'm getting this error when attempting to enter a name with an apostrophe:Expected token 'eof' found 'NAME'. 'o'-->dell<--'Huh? If anyone can let me know what I'm doing wrong, that would be great. Thanks.
  21. I'm trying to use regular expressions in my ASP.NET doc, and I'm running into a problem. This is how I've set it up: <%@ import Namespace="System.Text.RegularExpressions" %><%'Validate form data - required fields onlyDim RegularExpressionObject As Object RegularExpressionObject = New RegExp With RegularExpressionObject .Pattern = "[A-Za-z0-9]" .IgnoreCase = True .Global = TrueEnd With%> And this is the error that I'm receiving:Compilation ErrorType 'RegExp' is not defined.Line 77: Dim RegularExpressionObject As ObjectLine 78: Line 79: RegularExpressionObject = New RegExpLine 80: Line 81: With RegularExpressionObjectIf anyone can give me some advice on my I'm getting this error message, it would be greatly appreciated. Thanks.
  22. I'm trying to pass an XSLT parameter into an ASP.NET page, and back again, but it's not getting passed for some reason. If someone could let me know what I'm doing wrong, and possible help me out with a solution, it would be greatly appreciated. Thanks.XML DOC: <?xml version="1.0" encoding="ISO-8859-1"?><feedback> <feedback id="1"> <fname>FIRSTNAME</fname> <lname>LASTNAME</lname> </feedback></feedback> XSLT DOC: <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml" encoding="UTF-8" indent="yes"/><!-- PAGE-SPECIFIC PARAMETERS --><xsl:param name="fname_val" select="''" /><xsl:param name="lname_val" select="''" /><!-- FORM VALIDATION VARIABLES --><xsl:variable name="fname_msg">Must enter between 1 and 30 characters</xsl:variable><xsl:variable name="lname_msg">Must enter between 1 and 30 characters</xsl:variable> <xsl:template match="/"> <form method="post" action="feedback.aspx"> <table class="navyblueborder" width="100%"> <xsl:for-each select="feedback/feedback"> <tr> <td class="whiteheader" bgcolor="#333366" colspan="2">Feedback Form</td> </tr> <tr> <td bgcolor="#ccccff"><strong>First Name:</strong></td> <td bgcolor="#ccccff"><input type="text" id="txtfname" name="txtfname" value="fname_test" size="30" maxlength="30" tabindex="1" /> <font color="red">* <xsl:if test="$fname_val != ''"> <xsl:value-of select="$fname_msg" /> </xsl:if> </font> </td> </tr> <tr> <td bgcolor="#ccccff"><strong>Last Name:</strong></td> <td bgcolor="#ccccff"><input type="text" id="txtlname" name="txtlname" value="lname_test" size="30" maxlength="30" tabindex="2" /> <font color="red">*</font></td> </tr> </xsl:for-each> </table> </form> </xsl:template></xsl:stylesheet> ASP.NET DOC (feedback.aspx): <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true" %><% 'Declare XML and XSL file paths Dim xmlURL As String, xslURL As String xmlURL = "feedback.xml" xslURL = "feedback.xsl" 'Load XML Dim xml = Server.CreateObject("MSXML2.DOMDocument.3.0") xml.async = false xml.load(xmlURL) 'Load XSL Dim xsl = Server.CreateObject("MSXML2.DOMDocument.3.0") xsl.async = false xsl.load(xslURL) 'Pull in form data Dim fname_form As String = trim(Request.Form("txtfname")) 'REQUIRED Dim lname_form As String = trim(Request.Form("txtlname")) 'REQUIRED 'Test pulled in form data Response.Write("Form FName: " + fname_form + "<br />") 'TEST Response.Write("Form LName: " + lname_form + "<br />") 'TEST 'Pull in XSL parameters Dim fname_param = xsl.selectSingleNode("//xsl:param[@name='fname_val']") fname_param.SetAttribute("select", "'" & fname_form & "'") Response.Write("XML FName: " + fname_param + "<br />") 'TEST Dim lname_param As String = xsl.selectSingleNode("//xsl:param[@name='lname_val']") fname_param.SetAttribute("select", "'" & lname_form & "'") Response.Write("XML LName: " + lname_qs + "<br />") 'TEST%> RESULTING ERROR:Exception Details: System.NullReferenceException: Object variable or With block variable not set.Source Error:Line 49: Dim fname_param = xsl.selectSingleNode("//xsl:param[@name=fname_val]")Line 50: fname_param.SetAttribute("select", "'" & fname_form & "'") '<!---***ERROR IS ON THIS LINE***Line 51: Response.Write("XML FName: " + fname_param + "<br />") 'TESTLine 52:
  23. I received a working answer from another forum, and here it is: So I just changed it from:".vb"" />"to:".vb"" /></script>"...and it now works great. Thanks anyway:)
  24. I've created a way to dynamically call a VB script from an ASP.NET page, like this:Code: 'Dynamic VB fileDim dynamicscript1 = "<script language=""vb"" runat=""server"" src=""/maindirectory/"Dim dynamicscript2 = dir_path + subdir1_path + subdir2_pathDim dynamicscript3 = "bgscripts/vb/"Dim dynamicscript4 = page_pathDim dynamicscript5 = ".vb"" />"Response.Write(dynamicscript1 + dynamicscript2 + dynamicscript3 + dynamicscript4 + dynamicscript5) Result:<script language="vb" runat="server" src="/maindirectory/directory/subdirectory1/subdirectory2/pagename.vb" />Firefox = Shows up great on display and in source codeIE = Shows up in code, but not on display of page. Page is just blank.I also manually put the same resulting script onto the page, and the page loaded fine in IE. It's only having a problem when I use the above script. If anyone can help me to figure out what I'm doing wrong, it would be greatly appreciated. Thanks.
  25. I'm using this ActiveX Script within a DTS package that imports data from a .txt file into a DB table. This is a sample of what the text file looks like: text_registrant_id,text_name,date_of_birth01,01.01,01/01/198102,02.02,02/02/198203,03.03,03/03/1983...and so on ...and here's the ActiveX Script: '**********************************************************************' Visual Basic ActiveX Script'************************************************************************Function Main() Main = DTSTaskExecResult_Success Dim fso, f, i, j, k, t, row, datetime_array, StartingKeyValue, StartingOtherValue, NewStartingKey, NewStartingOther, swap_pos, DimensionToSort, OtherDimension Dim NewFile, OldFile2, log, incoming, incoming_files, dir_count, willholddate Set fso = CreateObject("Scripting.FileSystemObject") Set incoming = fso.GetFolder("\\SERVERNAME\DIRECTORY\FOLDER1\") Set incoming_files = incoming.Files dir_count = incoming_files.Count ReDim datetime_array(dir_count, 1) ' *** This loop will load the array with the DateLastModified file attribute *** For Each k in incoming_files datetime_array(i, 0) = k.Name datetime_array(i, 1) = k.DateLastModified i = i + 1 Next ' *** This loop will perform the DateTime sort *** Const column = 1 DimensionToSort = 1 OtherDimension = 0 For row = 0 To dir_count - 1 StartingKeyValue = datetime_array ( row, DimensionToSort ) StartingOtherValue = datetime_array ( row, OtherDimension ) NewStartingKey = datetime_array ( row, DimensionToSort ) NewStartingOther = datetime_array ( row, OtherDimension ) swap_pos = row For j = row + 1 to dir_count - 1 If datetime_array ( j, DimensionToSort ) < NewStartingKey Then swap_pos = j NewStartingKey = datetime_array ( j, DimensionToSort ) NewStartingOther = datetime_array ( j, OtherDimension ) End If Next If swap_pos <> row Then datetime_array ( swap_pos, DimensionToSort ) = StartingKeyValue datetime_array ( swap_pos, OtherDimension ) = StartingOtherValue datetime_array ( row, DimensionToSort ) = NewStartingKey datetime_array ( row, OtherDimension ) = NewStartingOther End If Next ' *** This is where the file gets set *** NewFile = "\\SERVERNAME\DIRECTORY\FOLDER1\" & datetime_array(dir_count - 1, 0) RenamedFile = "\\SERVERNAME\DIRECTORY\FOLDER1\new_export.txt" OldFile = "\\SERVERNAME\DIRECTORY\reg_voters2\" & datetime_array(dir_count - 1, 0) Import = "\\SERVERNAME\DIRECTORY\reg_voters2\new_export.txt" ' *** Rename the file to the name that the Data Source expects *** If fso.FileExists(NewFile) Then fso.MoveFile NewFile, RenamedFile fso.CopyFile RenamedFile, Import fso.DeleteFile RenamedFile End IfEnd Function It works great, but now I need to do the following, and I'm not sure how to include it in this code.1) Split Precinct_ID and Part_ID (one value = "01.01") into two values ("01" and "01")2) 'Split and reformat DOB (from "01/01/1981" to "19810101")This is what I have so far: Function newImport() 'Split Precinct_ID and Part_ID Dim OldPP As String = text_name If OldPP <> "" Then Dim Precinct_ID As String = Substring-before(OldPP, ".") Part_ID As String = Substring-after(OldPP, ".") End If 'Split and reformat DOB Dim FullDate As String = date_of_birth If FullDate <> "" Then Dim OldDate As String = RTrim(date_of_birth) Dim Date_mm As String = Substring-before(OldDate, "/") Dim Date_yyyy As String = Substring-after(OldDate, "/") Dim Date_dd As String = Substring-before(Date_ddyyyy, "/") Dim Date_ddyyyy As String = Substring-after(Date_ddyyyy, "/") Dim NewDate As String = Date_yyyy + Date_mm + Date_dd End IfEnd Function ...but I'm not sure how to include it within the ActiveX Script, being that I'm somewhat of a newbie. If anyone can help me out or point me in the right direction, it would be greatly appreciated. Thanks.
×
×
  • Create New...