Jump to content

kwilliams

Members
  • Content Count

    229
  • Joined

  • Last visited

Everything posted by kwilliams

  1. I'm a newbie to ASP.NET and VB.NET, and I'm trying to develop a way to include an external script file to a central ASP.NET page. After doing some research, I found information on the ClientScriptManager.RegisterClientScriptInclude Method at http://msdn2.microsoft.com/en-us/library/2552td66.aspx.So this is what I developed for my page: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AspCompat="true" Debug="true" %><%@ import Namespace="System.Data" %><%@ import Namespace="System" %><%@ import Namespace="System.IO" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Text.RegularExpressions" %><%@ import Namespace="System.Web.UI" %>Sub Page_Load(sender As Object, e As EventArgs)Dim page_path = page_qs 'Querystring variable unique to each pageDim vbkey As String = page_pathDim vbpath As String = "http://SERVERNAME/DIRECTORY/bgscripts/vb/vbdoc.vb"'Define the name, type and url of the client script on the page. Dim csname As String = vbkey Dim csurl As String = vbpath Dim cstype As Type = Me.GetType() ' Get a ClientScriptManager reference from the Page class. Dim cs As ClientScriptManager = Page.ClientScript ' Check to see if the include script is already registered. If (Not cs.IsClientScriptIncludeRegistered(cstype, vbkey)) Then cs.RegisterClientScriptInclude(cstype, vbkey, ResolveClientUrl(vbpath_new)) End IfEnd Sub But I'm receving this error message:Compiler Error Message: BC30002: Type 'ClientScriptManager' is not defined.I made sure to register the namespace at the top of the page (<%@ import Namespace="System.Web.UI" %>), but I'm still getting the same error. If anyone can help me to figure out what I'm doing wrong, that would be great. Thanks.
  2. Ok, I figured out how to do it as soon as I added my last post.This is the solution that worked for me: <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs)</script><script runat="server"> 'Page code goes here</script><script language="vb" runat="server" src="external.vb" /><script runat="server"> End Sub</script> And it worked! The change only resulted in the filesize being 142 bytes greater in size, but I'm not sure if doing it this way will cause any problems. If anyone knows whether or not it will cause problems, please let me know. Thanks.
  3. But I need to include the external document's VB.NET code within the script tag, which I can't do with SSI's. I tried it just for the heck of it, and I received the following error:Parser Error Message: Server includes are not allowed in server script tags.I use Web Matrix for development, so I wouldn't know how to do the other suggestion. If you or anyone else has any other suggestions, I'd love to hear them. Thanks.
  4. I'm a newbie to VB.NET, and I need to know how to call code from an external VB.NET file from within method body. I was thinking something like this:CODE: <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) 'Code for this page '...some code... 'Code from external VB.NET doc goes here - HOW??? End Sub</script> EXTERNAL VB.NET DOC'S CODE: Sub hello headtitle.text = "HELLO WORLD!"End SubIf Not Page.IsPostBack Then '...some code...End If RESULTING CODE: <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) 'Code for this page '...some code... 'Code from external VB.NET doc Sub hello headtitle.text = "HELLO WORLD!" End Sub If Not Page.IsPostBack Then '...some code... End If End Sub</script> If anyone can show me how to do this, that would be great. Thanks.
  5. I currently have a site that uses ASP.NET, VB.NET, XML, and XSLT using XSL Transformation in ASP.NET. My current method is this: <script runat="server"> Sub Page_Load 'Pull page_qs querystring variable Dim page_qs As String = Request.QueryString("page") 'Load XML file w/page_qs variable selected and assign page properties Dim il_xmld As XmlDocument Dim il_nodelist As XmlNodeList Dim il_node As XmlNode 'Create the XML Document il_xmld = New XmlDocument() 'Load the Xml file il_xmld.Load("links.xml") 'Get the list of name nodes il_nodelist = il_xmld.SelectNodes("/links/page[@id = '" & page_qs & "']") 'Loop through the nodes For Each il_node In il_nodelist 'Get an Attribute Value Dim page_id = il_node.Attributes.GetNamedItem("id").Value 'Pull XML nodes dir_code = il_node.Item("dir_code").InnerText subdir1_code = il_node.Item("subdir1_code").InnerText subdir2_code = il_node.Item("subdir2_code").InnerText 'Page path creator 'If dir is empty path_slash = "/" If dir_code = "" Then dir_path = "" Else dir_path = dir_code + path_slash End If 'If subdir1 is empty If subdir1_code = "" Then subdir1_path = "" Else subdir1_path = subdir1_code + path_slash End If 'If subdir2 is empty If subdir2_code = "" Then subdir2_path = "" Else subdir2_path = subdir2_code + path_slash End If 'If page is not empty If page_id <> "" Then page_path = page_id End If 'Declare XML and XSL file paths Dim xmlURL As String, xslURL As String xmlURL = "/DIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xml/" + page_path + ".xml" xslURL = "/DIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xslt/" + page_path + ".xsl" 'Assign dynamic url for this page xslTransform.DocumentSource = xmlURL xslTransform.TransformSource = xslURL '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) End Sub</script><html><body> <form runat="server"> <asp:Xml id="xslTransform" runat="server"></asp:Xml> </form></body></html> But I was wondering, would it be more or less efficient for me to create a function that transforms the XML and XSLT files in the code using the transformNode method by calling the function from a label in the form tag? I guess I'm thinking something like this: <script runat="server"> Sub Page_Load Function webdata 'Pull page_qs querystring variable Dim page_qs As String = Request.QueryString("page") 'Load XML file w/page_qs variable selected and assign page properties Dim il_xmld As XmlDocument '.... SAME AS ABOVE '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) 'Transform file webdata.Text = xml.transformNode(xsl) End Function End Sub</script><html><body> <form runat="server"> <asp:Label id="webdata" runat="server" /> </form></body></html> NOTE: Please keep in mind that I'm a newbie to all of this, so I realize that my logic may not be correct in the second example.Or is the difference so minor that it doesn't matter? I'd greatly appreciate some input on this. Thanks for any advice.
  6. Well, I solved this one after further research and testing. I just needed to assign the form field xmlTransorm within the code of the document to retain a dynamic page. So this is what I did: <script language="VB" runat="server">Dim xmlURL As String, xslURL As StringxmlURL = "/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xml/" + page_path + ".xml"xslURL = "/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xslt/" + page_path + ".xsl"'Assign dynamic urlS for this pagexslTransform.DocumentSource = xmlURLxslTransform.TransformSource = xslURL</script><html><body><form runat="server"> <asp:Xml id="xslTransform" runat="server"></asp:Xml></form></body></html> ...and it worked great. There's a great online article that comes from the book "XSLT for ASP.NET" that talks about this at http://www.topxml.com/dotnet/articles/xslt/default.asp. Even thought I code in VB.NET, and this book uses C# for its examples, I definitely intend to get this book.
  7. I'm trying to convert an ASP page that uses XML/XSLT Transformation into an ASP.NET page that uses the same transformation. The old ASP page was like this: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" aspcompat="true" Debug="true" %><%@ OutputCache Duration="10" VaryByParam="*"%><%@ import Namespace="System.Data" %><%@ import Namespace="System" %><%@ import Namespace="System.IO" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Text.RegularExpressions" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%'Declare querystring variablesDim page As String = Request.QueryString("page")Dim dir As String = Request.QueryString("dir")Dim subdir1 As String = Request.QueryString("subdir1")Dim subdir2 As String = Request.QueryString("subdir2")Dim subleftnav As String = Request.QueryString("subleftnav")%><%'Path separaterDim path_slash As String = "/"'Declare transformed variablesDim page_path As String, dir_path As String, subdir1_path As String, subdir2_path As String'If dir is emptyIf dir = "" Thendir_path = ""Elsedir_path = dir + path_slashEnd If'If subdir1 is emptyIf subdir1 = "" Thensubdir1_path = ""Elsesubdir1_path = subdir1 + path_slashEnd If'If subdir2 is emptyIf subdir2 = "" Thensubdir2_path = ""Elsesubdir2_path = subdir2 + path_slashEnd If'If page is not emptyIf page <> "" Thenpage_path = pageEnd If%><%'Declare XML and XSL file pathsDim xmlURL As String, xslURL As StringxmlURL = "http://SERVERNAME/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xml/" + page_path + ".xml"xslURL = "http://SERVERNAME/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xslt/" + page_path + ".xsl"'Test'Response.Write(xmlURL + "<br />" + xslURL)%><%'Load XML'Dim xml = Server.CreateObject("Microsoft.XMLDOM") 'DELETE LATERDim xml = Server.CreateObject("MSXML2.DOMDocument.3.0")xml.async = falsexml.load(xmlURL)'Load XSL'Dim xsl = Server.CreateObject("Microsoft.XMLDOM") 'DELETE LATERDim xsl = Server.CreateObject("MSXML2.DOMDocument.3.0")xsl.async = falsexsl.load(xslURL)'Transform fileResponse.Write(xml.transformNode(xsl))%> ...and the new ASP.NET page I've developed is so far like this: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AspCompat="true" Debug="true" %><%@ import Namespace="System.Data" %><%@ import Namespace="System" %><%@ import Namespace="System.IO" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Text.RegularExpressions" %><script runat="server"> Sub Page_Load 'To import XML/XSLT Transformation using DOM 'Declare querystring variables Dim page As String = Request.QueryString("page") Dim dir As String = Request.QueryString("dir") Dim subdir1 As String = Request.QueryString("subdir1") Dim subdir2 As String = Request.QueryString("subdir2") Dim subleftnav As String = Request.QueryString("subleftnav") 'Path separater Dim path_slash As String = "/" 'Declare transformed variables Dim page_path As String, dir_path As String, subdir1_path As String, subdir2_path As String 'If dir is empty If dir = "" Then dir_path = "" Else dir_path = dir + path_slash End If 'If subdir1 is empty If subdir1 = "" Then subdir1_path = "" Else subdir1_path = subdir1 + path_slash End If 'If subdir2 is empty If subdir2 = "" Then subdir2_path = "" Else subdir2_path = subdir2 + path_slash End If 'If page is not empty If page <> "" Then page_path = page End If 'Declare XML and XSL file paths Dim xmlURL As String, xslURL As String xmlURL = "http://SERVERNAME/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xml/" + page_path + ".xml" xslURL = "http://SERVERNAME/MAINDIRECTORY/" + dir_path + subdir1_path + subdir2_path + "docs/xslt/" + page_path + ".xsl" 'Response.Write(xmlURL + "<br />" + xslURL) 'Test 'Load XML 'Dim xml = Server.CreateObject("Microsoft.XMLDOM") 'DELETE LATER Dim xml = Server.CreateObject("MSXML2.DOMDocument.3.0") xml.async = false xml.load(xmlURL) 'Load XSL 'Dim xsl = Server.CreateObject("Microsoft.XMLDOM") 'DELETE LATER Dim xsl = Server.CreateObject("MSXML2.DOMDocument.3.0") xsl.async = false xsl.load(xslURL) 'Transform file 'Response.Write(xml.transformNode(xsl)) 'This method DOES work End Sub</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><body> <form runat="server"> <asp:Xml id="xslTransform" runat="server" DocumentSource="<%=(xmlURL)%>" TransformSource="<%=(xslURL)%>"></asp:Xml> </form><!-- This method DOES NOT work --></body></html> When I use this property to transform the 2 files: 'Transform file 'Response.Write(xml.transformNode(xsl)) ...it comes through fine.But when I attempt to use this method to transform the 2 files: <form runat="server"> <asp:Xml id="xslTransform" runat="server" DocumentSource="<%=(xmlURL)%>" TransformSource="<%=(xslURL)%>"></asp:Xml> </form> ...I receive this error message: Exception Details: System.ArgumentException: Illegal characters in path.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.I'm wanting to use the second method because I want to load the data directly in the <body> tag of the page. If anyone can see what I'm doing wrong, and let me know how to correct it, that would be greatly appreciated. Thanks.
  8. I've created a new site that uses ASP.NET and XML with the help of Web Matrix. I've really appreciated how light and easy-to-use the Web Matrix has been. But some downsides that I've discovered are not much support and no training, as everything's set up for Visual Studio.NET users.So my question is, what are the pro's and con's to using Web Matrix or Visual Web Developer Express in ASP.NET development? Thanks for any advice.
  9. I have a page that's written in ASP with VB syntax. I'd like to create a script or function that redirects the user to a logoff page before their session.timeout = 0. That's because the logoff page will add a 'False' flag to a DB table in SQL Server 2k with the use of their AccountID. Does anyone know of an easy way to do this? Thanks for any help.
  10. Hi aspnetguy,I had a chance to look at FormsAuthentication, and it looks like it will be a good solution for future projects. But unfortunately I have a deadline for this project of next Friday, and I'm still running into the same problems with sessions. So I thought that I'd try again...Basically, the session variables are timing out before the session.timeout and session.sessionid methods have timed out. So this is the scenario:On initial login:Session("Group") = "A"Session.Timeout = 20Session.SessionID = a bunch of codeAfter 20 minutes of activity:Session("Group") = ""Session.Timeout = 20Session.SessionID = a bunch of codeThe session.timeout and session.sessionid variables are staying active properly, but the session("Group") variable is timing out on it's own even though the page is being refreshed by the user (me).I also tried changing the web.config file itself to set the sessionState, like this:<configuration> <appSettings> </appSettings> <system.web> <customErrors mode="Off" /> <SessionState timeout="20" /> </system.web></configuration>...but I received this error message: Runtime ErrorDescription: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="Off"/> </system.web></configuration>Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web></configuration>...but I already have the "customErrors" set to "Off", so I'm not sure why I'm getting this error message.Has anyone run into these issues, and if so, is there a solution for it? My operating system is Windows XP, and my test server is running IIS6 if that makes any difference. Thanks for any help.
  11. Ok, thanks aspnetguy. I'll try to find something.If anyone can try to answer my other questions about encryption, that would be great too:)
  12. That's good to know, but I'd really like to avoid using a 3rd-party vendor, as we are a local government, and it's not easy to get those approved. So if I was to set this up on my own with a DTS pkg, how secure would that be? That seems like it could open up a small hole for any possible hackers.
  13. First off, I'm using SQL Server 2k for the backend and ASP.NET/VB.NET for the front-end.A few questions were posed to me by my boss, and I'd like to get some constructive advice on what he's requesting, and what my answers were to him. Ok, here they are:1) Data Export from Internet Server to Intranet ServerCurrent Setup: We have 2 copies of each table. One is on the web server for display-purposes only, and another is on the internal server where editing is done through front-ends. Boss's Suggested Setup: He wants to have 1 copy of each table that resides on the internal server, and set up jobs to export certain data from the web server to the internal server.My View: I think that if this is possible, it's not a good idea to do for security reasons. I think that it would just open us up to possible hacking directly onto our internal server.Questions:Can you export data from the web server to the internal server when data is edited on the web server?If so, how secure is it to have that setup?2) Encryption/DecryptionDescription of Situation: We currently have a DB table that contains a password column that's not encrypted. My boss wants to encrypt that column directly in the DB table. I researched the subject at this and other forums, and read several accounts about how difficult it is to use encryption within SQL Server. I read from several sources that the two functions used by some (pwdencrypt and pwdcompare) are not supported by Microsoft, so you're on your own if you have any problems. Also, I read that some developers had problems when they upgraded to a newer version of SQL Server.Questions:1) Which setup is better with excryption/decryption:A) Doing it within SQL Server 2k:) Doing it on the front-end with the keys stored in a secure directoryMy View: I'd only like to use a solution within SQL Server that doesn't run into the previosly mentioned set of problems. If there is no way to accomplish this, I think that it would be better to do the encryption/decryption on the application's side of things.Ok, that should do it. I hope to hear some good advice. Thanks.
  14. I received a great answer from Jeff Mason in another forum. You can see the thread at http://p2p.wrox.com/topic.asp?TOPIC_ID=46164. It basically had to do with me setting an INNER JOIN vs. a LEFT OUTER JOIN. The latter preserves Table1, and the other empty table(s) return null values from the query. Thanks Jeff:)
  15. Ok, after some further testing, I've found the problem. It's actually unrelated to the query that we've been using, so that's why I was getting a different result. The entire query contains 3 tables with inner joins, and one of the tables doesn't have data for this property, so it affects the entire query.This is the entire query that I have:SELECT T1.Col1, T1.Col2, T1.Col3, T2.Col1, T2.Col2, T2.Col3, T3.Col1, T3.Col2, T3.Col3FROM TABLE1 T1 INNER JOIN TABLE2 T2 ON T1.Col1 = T2.Col1 INNER JOIN TABLE3 T3 ON T1.Col1 = T3.Col1WHERE (T1.Col1 LIKE '15%') AND (T1.Col2 LIKE 'ACORN LN%') AND (T1.Col3 = '2006')ORDER BY T1.Col1I know that it's a bit confusing, but basically Table3 is empty for this property, so no records show up at all on this query. So within a SQL query, is there a way to use a table with inner joins on tables that may or may not have data within them, because I'm not sure how to do that being a newbie to SP's. Sorry for the mis-direction.
  16. I have a stored procedure that gets called from an ASP/VB syntax front-end, and a SQL Server 2k back-end, and I'm running into a problem with the results. Basically, I'm trying to get block data from around an address. But I get two records when I should get 4 records.Below is the code that I have so far. When I do this either through the front-end or directly through the SQL Server Query Analyzer, I get partial results. But when I do this manually through SQL Server, I'm able to get the proper results. I'm stumped, so I'd greatly appreciate any help. Thanks.1) FRONT-END:'Declare variablesDim strStreetNbr_db As String = Session("StreetNbrDb")Dim strDefaultYear As String = "2006"Dim strStreetNbr_db_b As String, strPlate_reblock As String, objKillQuery As Object'Pull in form ValuesDim strVar1 As String, strVar2 As String, strVar3 As String'Manipulate form ValuesIf objForm1 = True Then 'Assign variables strStreetNbr_db As String = Trim(Request.Form("strnbr") '***NOTE: Result is "1519" (without quotes)*** strStreetName_db As String = Trim(Request.Form("strname") '***NOTE: Result is "ACORN LN" (without quotes)*** strYear As String = strDefaultYear '***NOTE: Result is "2006" (without quotes)*** 'Determine length of address number Select Case Len(strStreetNbr_db) Case "1" strStreetNbr_db = "" strStreetNbr_db_b = "_" Case "2" strStreetNbr_db = "" strStreetNbr_db_b = "__" Case "3" strStreetNbr_db = Left(strStreetNbr_db, 1) strStreetNbr_db_b = strStreetNbr_db & "%" Case "4" strStreetNbr_db = Left(strStreetNbr_db, 2) strStreetNbr_db_b = strStreetNbr_db & "%" Case "5" strStreetNbr_db = Left(strStreetNbr_db, 3) strStreetNbr_db_b = strStreetNbr_db & "%" Case Else objKillQuery = True End Select '***NOTE: Result is "15%" (without quotes)*** 'Display data Response.Write("<table class='medbeborder' width='100%'>") Response.Write("<tr class='medbeheader' colspan='5'>") Response.Write("<td align='center'>Street #</td>") Response.Write("<td align='center'>Street Name</td>") Response.Write("<td align='center'>Year</td>") Response.Write("</tr>") If objKillQuery <> True Then '------------------Block Query Begins--------------------- Dim sqlBlockQuery As Object, rsBlockQuery As Object objConn = Server.CreateObject("ADODB.Connection") objConn.Open (strConnLandUse) sqlBlockQuery = "spBlock @Par1 = '" & strStreetNbr_db_b & "', @Par2 = '" & strStreetName_db & "', @Par3 = '" & strDefaultYear & "'" rsBlockQuery = objConn.Execute(sqlBlockQuery) 'Response.Write("sqlBlockQuery & "<br />") 'TEST '***NOTE: Result is spBlock @Par1 = '15%', @Par2 = 'ACORN LN', @Par3 = '2006' *** If NOT rsBlockQuery.EOF Then 'If RS is not empty Do While NOT rsBlockQuery.EOF 'Begin loop intRecordCount = intRecordCount + 1 'Record counter If intRecordCount > 200 Then Exit Do 'Exit from infinite loop If intRecordCount <= 200 Then 'Display results (under 200 records) Response.Write("<td align='center'>" & Trim(rsBlockQuery("StrNbr").Value.ToString) & "</td>") Response.Write("<td align='center'>" & Trim(rsBlockQuery("StrName").Value.ToString) & "</td>") Response.Write("<td align='center'>" & Trim(rsBlockQuery("Year").Value.ToString) & "</td>") Response.Write("</tr>") End If rsBlockQuery.MoveNext Loop 'End loop Do While NOT rsBlockQuery.EOF End If sqlBlockQuery = nothing rsBlockQuery = nothing objConn.Close objConn = nothing intRecordCount = 0 'Reset record counter '------------------Block Query Ends----------------------- End If 'End If objKillQuery <> True Response.Write("</table>")End If 'End objForm1 = True2) BACKEND:Stored Procedure:CREATE PROCEDURE [dbo].[spBlock]@Par1 varchar (13),@Par2 varchar (24),@Par3 varchar (4)ASSET NOCOUNT ONSELECT *FROM tblBlockWHERE Col1 LIKE @Par1 AND Col2 LIKE @Par2 AND Year = @Par3ORDER BY Col1 ASCSET NOCOUNT OFFGOResulting Stored Procedure on Front-End:spBlock @Par1 = '15%', @Par2 = 'ACORN LN', @Par3 = '2006'(NOTE: Results in partial data - 2 records)Manual Query of Same Data:SELECT *FROM tblBlockWHERE (Col1 LIKE '15%') AND (Col2 = 'ACORN LN') AND (Col3 = '2006')(NOTE: Results in correct data - 4 records)
  17. Yes, I would love more information. Again, I really appreciate your help. Thanks.
  18. I'm using Sessions throughout the site to store the user's SessionID, AccountID, and GroupID. We use all of these sessions to give users specific rights to sections of the site, and to set the proper navigation. We also insert the SessionID into a DB table to authentification of an external application, so we couldn't use the "FormsAuthentication" option that you mentioned for that. But I'll definitely look into it in the future for internal form authentification. I did try the suggested change to the web.config file like this:<configuration> <system.web> <customErrors mode="Off" /> <sessionState timeout="20" /> </system.web></configuration>...but I received the following error message:Server Error in '/' Application.Runtime ErrorDescription: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="Off"/> </system.web></configuration>Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<!-- Web.Config Configuration File --><configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web></configuration>I'm new to using the web.config file, so do you know what I should do next? I appreciate your help:)
  19. I'll give this a try. That's just too bad that it doesn't work as it should. Yeah, I think it's strange also. I never had this problem with ASP applications. I made sure that there are no other Session.Timeout's throughout the site besides the main one, but it's still acting strangly. I'll give pulpfiction's option a try, and I'll let you know if it works for me. Thanks for the replies.
  20. kwilliams

    Session Questions

    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.
  21. 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.
  22. 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.
  23. 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.
  24. 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.
×
×
  • Create New...