|
|
jrahma wrote: (string)Request.ServerVariables["REMOTE_ADDR"];
As the previous post said, you have to make sure the value really exist before you assign it to something.
1. So you should of gathered up all your data first,
2. check to make sure it is complete and formatted correctly,
3. then do your write to the database.
|
|
|
|
|
I am sure REMOTE_ADDR is returning the correct value. because I tried to write it and getting the data. also I am getting everything working on local laptop and this problem occurs only on host.
I even tried to pass DBNull.Value but getting the same error!
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
|
|
|
|
|
|
That's a nice looking website, good job. I like the buttons, whole site is nice and clean.
param_ipAddress, the param is missing from 1 of 3 places, below
UPDATE Contact Set(ipAddress=@ipAddress) <- Is this missing
Or is your Param not stated correctly ?
Dim paramIPAddress As SqlParameter
paramIPAddress = New SqlParameter("@ipAddress", SqlDbType.VarChar, 80)
paramIPAddress.Value = ipAddress
myCommand.Parameters.Add(paramIPAddress)
Or is the value simply missing?
ipAddress simply has no value and = nothing
|
|
|
|
|
is it really nice? Thanks.. I am still working on completing it
Regarding where I am using it in the stored procedure.. it's here:
IN `param_id_number` varchar(255),IN `param_login_password` varchar(255),IN `param_login_pin` varchar(255),IN `param_ip_address` varchar(255),IN `param_machine_name` varchar(255),IN `param_os_version` varchar(255)
and then here:
INSERT INTO event_log (event_log_category, event_log_user, event_log_ip_address, event_log_machine_name, event_log_os_version, event_log_text) VALUES ('Audit', param_id_number, param_ip_address, param_machine_name, param_os_version, 'User logged on successfully');
and this is my parameter:
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = Request.ServerVariables["REMOTE_ADDR"];
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
value is not missing because I am able to write and I am also checking it if not null as you can see in above code...
|
|
|
|
|
Thanks everyone.
My problem if solved.
I used:
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = HttpContext.Current.Request.UserHostAddress;
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
|
|
|
|
|
sorry... problem is still there..
I didn't notice I was working on local...
and that's another question.. why it's working on local but throwing the error on host?!
|
|
|
|
|
You don't need to check the value here, since your passing the value to a function, just make sure the value is good before passing it the fucntion, so remove the first line and do it earlier, when your gather data
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = Request.ServerVariables["REMOTE_ADDR"];
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
I;m not sure what the problem is. I see lot's of tiny errors like the @ in front of the parameter name. @param_id_number
INSERT INTO event_log (event_log_category, event_log_user, event_log_ip_address, event_log_machine_name, event_log_os_version, event_log_text) VALUES ('Audit', @param_id_number, @param_ip_address, @param_machine_name, @param_os_version, 'User logged on successfully');
Those examples I gave you, you really need to look at the details of them.
On the param, you have to declare the variable, then make a new one. If you made the table column a width of let's say 80, use the 80.
I did some digging, and I stopped using the Server Request because it was not reliable, and changed to the UserHostAddress, use the context whenever you use request or response as a good habit.
Dim ipAddress as String = Nothing
ipAddress = HttpContext.Current.Request.UserHostAddress
Dim param_id_number As SqlParameter
param_id_number = New SqlParamter("@ip_Address, SQLDbType.VarChar, 80)
param_id_number.Value = <- Assign a pointer here like ipAddress
sql_command.Parameters.Add(param_ip_address)
|
|
|
|
|
I always copy the pointer to a buffer like ipAddress before using it.
if (Request.ServerVariables["REMOTE_ADDR"] != null){
ipAddress String = Request.ServerVariables["REMOTE_ADDR"];
sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = ipAddress;
}
else
{
sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
}
|
|
|
|
|
Hi,
am having an excel file where it consists data as below
ID NAME DE
1 SURESH SE
2 SANJAY SE
3 NAGA TL
ID,NAME,DE are columns...
if the data in excel file is in the above format then i can easily transfer the data into database
but my problem is sometimes the data in excel sheet will be in the below format
ID NAME DE ID NAME DE
1 SURESH SE 4 RANK TL
2 SANJAY SE 5 RAMU PL
3 NAGA TL 6 RANI PM
here the Columns ID,NAME,DE are repeated so i want to make it in the below format and want to insert into database
ID NAME DE
1 SURESH SE
2 SANJAY SE
3 NAGA TL
4 RANK TL
5 RAMU PL
6 RANI PM
please help me out...
|
|
|
|
|
I am having problem with one line compiling in a production C# 2010 web form application. The line of code that is having the problem is either of the two following lines:
<%@ language="c#" debug="true" trace="false" %>
<%@ Register TagPrefix="mp" namespace="Microsoft.Web.Samples.MasterPages" assembly="MasterPages" %>
the error message is: 'Error 1 Could not load file or assembly 'MasterPages' or one of its dependencies. The system cannot find the file specified.
I am hoping you can tell me what is wrong. Could a url to iis7 local server be incorrect?
I orginally had the folloing 3 extra lines of code of code that contained error messages:
Error 2 Unknown server tag 'mp:contentcontainer'. C:\Users\Sup\TestPage.aspx 14
Error 3 Unknown server tag 'mp:content'. C:\Users\Sup\TestPage.aspx 16
Error 4 Unknown server tag 'mp:content'. C:\Users\Sup\TestPage.aspx 22
I fixed the above error message by adding the following to the web config file:
<system.web><pages><controls>
<add assembly="MasterPages" namespace="Microsoft.Web.Samples.MasterPages" tagPrefix="mp" />
<add src="~/sub/TestMasterPage.ascx" tagName="contentcontainer" tagPrefix="mp" />
</controls></pages></system.web>
The following is code for TestPage.aspx that is causing the error:
<%@ language="c#" debug="true" trace="false" %>
<%@ Register TagPrefix="mp" namespace="Microsoft.Web.Samples.MasterPages" assembly="MasterPages" %>
<script runat="server">
void ClickedCapitalize(object o, EventArgs e) {
capitalized.Text = Server.HtmlEncode(tb1.Text.ToUpper());
}
void SayHello(object o, EventArgs e) {
name.Text = Server.HtmlEncode(tb2.Text);
}
</script>
<mp:contentcontainer runat="server" MasterPageFile="sub/TestMasterPage.ascx">
<mp:content id=region1 runat="server">
<a href="MasterPages.htm" runat="server">Relative link test</a><br>
<asp:textbox id=tb1 runat="server"/><asp:button text=Capitalize onclick=ClickedCapitalize runat="server"/>
<asp:literal id=capitalized runat="server"/>
</mp:content>
<mp:content id="region2" runat="server">
<asp:textbox id="tb2" runat="server"/><asp:button text="Say hello" onclick="SayHello" runat="server"/>
Hello <asp:literal id="name" text="[name goes here]" runat="server"/>!
</mp:content>
</mp:contentcontainer>
|
|
|
|
|
classy_dog wrote: Error 1 Could not load file or assembly 'MasterPages' or one of its dependencies. The system cannot find the file specified.
Ok, it was not too clear based on your previous query asked last time, but now:
You are trying/working on an old project and trying to convert/add new features based on ASP.NET 2.0 above. You last project was probably in v1.1
When there was no concept of master pages, people writing your application code at that time, create a custom control/assembly named 'MasterPages' and used that as per need. Now, it looks like you thought/took it as ASP.NET master page and facing issues.
So, to be clear, the assembly in question 'MasterPages.dll' is your custom assembly and not ASP.NET assembly. This assembly is missing and you need to find and provide a reference to it in order to resolve the above errors.
|
|
|
|
|
I have a C# 2010 web form application that I would like to step though the code. I can put breakpoints in the *.aspx.cs files but I can not put breakpoints in the .aspx files. Thus is there any way that I can debug the .aspx pages? If so, can you tell me how to debug the *.aspx pages directly?
|
|
|
|
|
dcof wrote: Thus is there any way that I can debug the .aspx pages?
No. You cannot debug aspx pages. They are not server codes, they turn into plain HTML's.
Further, it's hard to think of a reason on why debugging 'aspx' code would be needed.
|
|
|
|
|
I am getting some errors in production application when I am trying to use the local iis. I do not know how to remove these errors.
|
|
|
|
|
Post an example of the error you are receiving and the folks here might be able to point you in the right direction for finding the problem.
The more details about the problem, the better.
Good luck.
|
|
|
|
|
I have a question about understanding how the master pages in C# 2010 web application are linked (wired together). I am asking that question since I believe I and/or my co-worker placed some test code in the location where the production code was actually stored.
What is happening is when I try to debug the production application using iis 7, a reference to a master page and/or an *ascx file is lost. The file that it is trying to access, is for a test version of one of the production modules. This test version of the production code is mainly commented out in the code right now. The part of the test code that actually is running is the startup file name that looks like 'startup2.aspx'. The test code is actually calling 'startup2.aspx' instead of 'startup.aspx'.
Thus to understand how the master pages are wired together I am thinking that I will debug the application from the time any code starts running. Can you tell me if this is a good idea?
Also I am wondering if you can tell me how master pages are actually 'wired' together? is there a good reference that I can look at?
|
|
|
|
|
dcof wrote: I am thinking that I will debug the application from the time any code starts running. Can you tell me if this is a good idea?
Yes, that should help. Do, make sur before making this effort, you clear your temporary files, cache, reset IIS and then recheck things on how they are working (just to avoid these be the reason of old file refrence issue.) BTW, I hope if there was a new deployment then, it's not just a file.
dcof wrote: is there a good reference that I can look at?
Look here:
MSDN: ASP.NET Master Pages[^]
ASPNET: ASP.NET Master Pages Tutorials[^]
ASP.NET 2.0 Master Pages[^]
|
|
|
|
|
When you mention "clear your temporary files, cache, reset IIS", I think you mean I should stop and start my workstation and stop and start iis that is on my work station correct? If this is not what you mean, can you tell me what you mean?
You mentioned, "I hope if there was a new deployment then, it's not just a file." There was no new deployment. Thus what would I be concerened about with a file?
Thanks for the online references!
|
|
|
|
|
dcof wrote: "clear your temporary files, cache, reset IIS", I think you mean I should stop and start my workstation and stop and start iis that is on my work station correct?
No, not just that, you need to also clear your browsers cache and system temporary files.
dcof wrote: I hope if there was a new deployment then, it's not just a file." There was no new deployment. Thus what would I be concerened about with a file
If you are replacing/updating a file then you need to make sure it's nothing more than a ASPX file with all it's class references intact. If you make any change in code behind file then you need to rebuild before deployment.
|
|
|
|
|
Hey, Just something to note, everybody is lead to believe that content pages are placed in to master pages when the application runs but it's actually the other way round, when you run you application, the webpage you run actually pulls the master page an displays it. So in short the content page is fired first and then the master page. Hope this helps you understand.
|
|
|
|
|
Hi,
What kind of host server (CPU? RAM? or anything else that is important)is suitable to support an application written in ASP.net and SQLserver 2008, which should handle 10000 users and around 1 GB data at one time parallely.
|
|
|
|
|
Hi,
In an asp.net application I want to convert xsl fo to xslt, is there any way that I can convert the xslfo to xslt or word or pdf just using MS.Net library, not any other tool to buy, I want to just use .Net framework.
Any kind of suuport like a code snippet or a link any kind of support would be really really helpfull.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 2-Jul-12 12:59pm.
|
|
|
|
|
Hi,
I my asp.net application I have to save a .doc file in to pdf file, so I am using the
Document.ExportAsFixedFormat method to convert and save as pdf. But it is storing only on to the disk in a physical location.
Is there any way that I can store output file pdf as a stream rather than in a physical location. Any kind of help would be really helpful please help me I am in a dire need.
If there is any alternate method available I am ready to accept it, any links or any advice is acceptable for me.
Thanks in advance. Below is my code.
Public Shared Function convertDoc2PDF(ByVal sourcePath As Object, ByVal targetPath As Object) As Boolean
Dim result As Boolean
Dim paramMissing As Object = Type.Missing
Dim wordApplication As New ApplicationClass
Dim wordDocument As Document = Nothing
Try
Dim paramSourceDocPath As Object = sourcePath
Dim paramExportFilePath As String = targetPath
Dim paramExportFormat As WdExportFormat = WdExportFormat.wdExportFormatPDF
Dim paramOpenAfterExport As Boolean = False
Dim paramExportOptimizeFor As WdExportOptimizeFor = WdExportOptimizeFor.wdExportOptimizeForPrint
Dim paramExportRange As WdExportRange = WdExportRange.wdExportAllDocument
Dim paramStartPage As Integer = 0
Dim paramEndPage As Integer = 0
Dim paramExportItem As WdExportItem = WdExportItem.wdExportDocumentContent
Dim paramIncludeDocProps As Boolean = True
Dim paramKeepIRM As Boolean = True
Dim paramCreateBookmarks As WdExportCreateBookmarks = WdExportCreateBookmarks.wdExportCreateWordBookmarks
Dim paramDocStructureTags As Boolean = True
Dim paramBitmapMissingFonts As Boolean = True
Dim paramUseISO19005_1 As Boolean = False
wordDocument = wordApplication.Documents.Open( _
paramSourceDocPath, paramMissing, True, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing)
If (wordDocument IsNot Nothing) Then
wordDocument.ExportAsFixedFormat(paramExportFilePath, _
paramExportFormat, paramOpenAfterExport, _
paramExportOptimizeFor, paramExportRange, paramStartPage, _
paramEndPage, paramExportItem, paramIncludeDocProps, _
paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, _
paramBitmapMissingFonts, paramUseISO19005_1, _
paramMissing)
End If
result = True
Catch ex As Exception
result = False
Finally
If (wordDocument IsNot Nothing) Then
wordDocument.Close(paramMissing, paramMissing, paramMissing)
wordDocument = Nothing
End If
If (wordApplication IsNot Nothing) Then
wordApplication.Quit(paramMissing, paramMissing, paramMissing)
wordApplication = Nothing
End If
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
GC.WaitForPendingFinalizers()
End Try
Return result
End Function
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 29-Jun-12 12:30pm.
|
|
|
|
|