|
I am writing to error log file in one of the folders in the application
|
|
|
|
|
Can you post the line of code.
|
|
|
|
|
public static class clsSystemUtilities
{
public static void WriteErrorToLog(string errorDesc)
{
string logFileName;
StreamWriter strWriter;
logFileName = ConfigurationManager.AppSettings["ErrorLogFileName"];
if (File.Exists(logFileName))
{
strWriter = File.AppendText(logFileName);
}
else
{
strWriter = File.CreateText(logFileName);
}
strWriter.WriteLine();
strWriter.Write(errorDesc);
|
|
|
|
|
I'm on my last nerve with this. I have been working for over 6 hours trying to figure out how to get this to work. Here is what went down:
I created my site, which is esentially just a database of people who work for me, their positions, ect. I created it offline, using Visual Studio 2008 Professional, and created the database under SQL Server 2005. I went to upload all my files, and my databases were stored in my app_data folder which was also uploaded. I have an app_code folder with my datasets in them.
Here is what my code looks like for...
web.config:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|database.mdf;User Instance=true"/>
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true">
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
Default.aspx.vb:
<pre>Partial Class _Default
Inherits System.Web.UI.Page
Dim DbConnect As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End Class
Default.aspx:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif">
<form id="form1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="ObjectDataSource1" DataTextField="Position"
DataValueField="Position">
</asp:DropDownList>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="Getposition"
TypeName="DataSet1TableAdapters.PositionlistTableAdapter">
</asp:ObjectDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID"
DataSourceID="ObjectDataSource2">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Position" HeaderText="Position"
SortExpression="Position" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:HyperLinkField DataNavigateUrlFields="ID"
DataNavigateUrlFormatString="Details.aspx?field={0}" HeaderText="Details"
Text="detail" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="DataSet1TableAdapters.teamTableAdapter" UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Position" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="Original_ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="position"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="Position" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Email" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
</form>
</body>
</html>
Details.aspx:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Details.aspx.vb" Inherits="Details" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family: Arial, Helvetica, sans-serif">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="ID" DataSourceID="ObjectDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Position" HeaderText="Position"
SortExpression="Position" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByID"
TypeName="DataSet1TableAdapters.teamTableAdapter" UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Position" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="Original_ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="Position" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Email" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
</div>
</form>
<p>
<a href="Default.aspx">Default.aspx</a></p>
</body>
</html>
Details.aspx.vb:
Partial Class Details
Inherits System.Web.UI.Page
Dim DbConnect As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End Class
I gave all the code I have, and am seriously considering giving up on this whole project. The thing is, the code works fine when I test it on my PC, but the minute I upload it online and go to my website I get this error:
Server Error in '/' Application.
Runtime Error
Description: 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>
Please help me, I'm going literally insane by not getting this to work. Any help is greatly appreciated. I've done a great deal of searching and nothing has helped me.
|
|
|
|
|
u need to configure the directory on the server for dotnet framework version u r using!
|
|
|
|
|
Sorry, I'm new at ASP .NET, but a long time Visual Basic and Visual Basic .NET user, please explain how I would go about doing that. My server has the latest Framework installed.
|
|
|
|
|
when u develop a web site and u want to deploy it u need a host this host will provide u a storage location for u r files. u need to inform u r hosting company that u want to configure that folder on there server for u r version of .net framework the same way u configure u r site locally for IIS.
|
|
|
|
|
This error might be occured due to various reasons.
Change <customErrors mode="Off"/> in your web.config so that you can see the proper error details.
|
|
|
|
|

Server Error in '/' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
Line 1423: this.Adapter.SelectCommand = this.CommandCollection[0];
Line 1424: DataSet1.PositionlistDataTable dataTable = new DataSet1.PositionlistDataTable();
Line 1425: this.Adapter.Fill(dataTable);
Line 1426: return dataTable;
Line 1427: }
Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cb8fe185\bde2cb14\App_Code.vkqy43db.0.cs Line: 1425
Stack Trace:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4860189
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4861315
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115
DataSet1TableAdapters.PositionlistTableAdapter.Getposition() in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cb8fe185\bde2cb14\App_Code.vkqy43db.0.cs:1425
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +488
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +18
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

|
|
|
|
|
It seems that your application is not able to connect with the SQL server database from within your application.
Check the SQL server connection string in your web.config.
|
|
|
|
|
<add name="ConnectionString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|database.mdf;User Instance=true"/>
That's it. I don't know how else to go about doing this. I have MS SQL database support on my hosting, I just don't know how to get it all working. Right now the database is just in the app_data folder.
|
|
|
|
|
Is your SQL Server database in the App_Data folder of the web application.
You are using Windows Authentication to connect with SQL Server dataqbase.
The ASP.NET application will run under Network Service account in the server. Therefore you need to provide access to the Network Service account to your database.
|
|
|
|
|
I'm completely confused. I'm new at this whole thing, what do I need to do, in detail, to get it to work?
Basically I am running on a server that I do not own, I just host there. It has Plesk control panel on it, and it allows me to create MS SQL databases and such. No idea.
|
|
|
|
|
If the server allows you to create SQL Server database,
Which connection details are you using?
The same connection details should be put your web.config file.
|
|
|
|
|
I don't have any connection details, I have a Plesk control panel, that allows me to create either an MS SQL database, or a MySQL database, all I know is that you create a database, in my case it would be erik_database, and a username, in my case I created it to be simply aspadmin, and that's it.
|
|
|
|
|
I assume that you have used SQL Server database in your application.
How do you create SQL server database in the server. Using SQL Management Studio?. if so, then you can see the server name, database name and also you need to enter password.
Assume that erik_database is name of the SQL database and aspadmin is the user name, 'YourServerName' is the server name, 'YourPassword' is the password to be used connect with database, then connection string in your web.config should be as below
<add name="connectionString" connectionString="Database=erik_database;server=YourServerName;Uid=aspadmin;pwd=YourPassowrd" providerName="System.Data.SqlClient"/>
modified on Sunday, May 31, 2009 11:04 AM
|
|
|
|
|
What is the common port for a MS SQL server?
|
|
|
|
|
|
I got my apps to connect, but now it's strange because every time I go to my site a username and password dialog shows up, and I can't even login. Odd.
|
|
|
|
|
Hello,
I'm working on a simple ASP .NET health checker and I've run into a few obstacles.
1) I need to be able to get the full non-paged memory usage from a remote machine (on same network). I've tried using System.Diganostics.Process.NonpagedSystemMemorySize64 however I've come to realize that the kernel's nonpaged usage is going to be missing from that total. Here is a quick sample of what I was doing:
Process[] myprocess = Process.GetProcesses("computername");
foreach (Process p in myprocess)
{
nonpaged += p.NonpagedSystemMemorySize64
}
2) I can overcome that locally by using System.Diagnostics.PerformanceCounter however you can only access the API for that class locally. Is there another class that would suit my needs?
Any help would be appreciated.
|
|
|
|
|
can anyone tell me when to use state server outprocess session and sql server out process session? and also give me some real time scenarios for both of them?
rajesh sunakri
|
|
|
|
|
State server session and SQL Serevr session are useful when you deploy your application in web Garden or Web Farm environment.
Web garden is a scenario in which a single server machine has multiple aspnet worker processes running simultaneously. The server should have multiple processor.
Web Farm is a method of hosting a web site in a cluster of servers. The web request to the web application will be handled by multiple servers.
StateServer is faster than SqlServer session. But SQL Server is more reliable and used for mission critical applications.
Check this link[^]
|
|
|
|
|
Hi Guys,
I have a web page with many controls in ASP.NET and I am showing records to these controls from database.
Now what I am trying to do is I want to create same page with same controls but this new page should be open as a tab page.
Could you please provide me any link or source code which can help me out?
(I am trying to create a TAB page with same controls)
Thanks,

|
|
|
|
|
u can use ajax or some javascript framework like jquery.
if u need more info tell me!
|
|
|
|
|
Use Ajax Tab control.
Look into this[^]
|
|
|
|
|