I am using VS2005 C# .NET 2.0
I am new to the use of Health Monitoring, and I am unsure how the log files are saved.
I have only configured my Web.config file, and I don't see any variable which declares where the log file will be saved.
Below is my Web.config code snippet:
<system.web>
<healthMonitoring enabled="true" heartbeatInterval="0">
<bufferModes>
<clear/>
<add name="Logging" maxBufferSize="1000" maxFlushSize="200" urgentFlushThreshold="800" regularFlushInterval="00:05:00" urgentFlushInterval="00:01:00" maxBufferThreads="1"/>
</bufferModes>
<providers>
<clear/>
<add name="MySqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider" connectionStringName="SODConnectionString" maxEventDetailsLength="1073741823" buffer="true" bufferMode="Logging"/>
</providers>
<eventMappings>
<clear/>
<add name="All Audits" type="System.Web.Management.WebAuditEvent" startEventCode="0" endEventCode="2147483647"/>
<add name="All Errors" type="System.Web.Management.WebBaseErrorEvent" startEventCode="0" endEventCode="2147483647"/>
</eventMappings>
<profiles>
<clear/>
<add name="Audit Logs" minInstances="1" maxLimit="Infinite" minInterval="00:00:15"/>
<add name="Error Logs" minInstances="1" maxLimit="Infinite" minInterval="00:00:15"/>
</profiles>
<rules>
<clear/>
<add name="All Audits Default" eventName="All Audits" provider="MySqlWebEventProvider" profile="Audit Logs"/>
<add name="All Errors Default" eventName="All Errors" provider="MySqlWebEventProvider" profile="Error Logs"/>
</rules>
</healthMonitoring>
</system.web>
May I know what are the other steps I will need to take?
This article should help you out...
http://msdn.microsoft.com/en-us/library/ff650305.aspx
The output depends on what you configure. Typically, you would go for EventLogs. But if you are doing extensive logging you may want to use different providers to output it in SQL or WMI.
Related
Here is some code of my app.config file in my windows form application. I used this configuration file for the printer and scanner. I have used custom configurations in this xml. The problem I'm facing is whenever any attribute value is not set, My application throws a built in message error box like "The port com 4 does not exists"
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Server" value="blah blah" />
<add key="Database" value="blah" />
<add key="User" value="blah" />
<add key="StoreID" value="blah" />
<add key="BranchID" value="blah" />
<add key="LotSize" value="100"/>
<add key="ZipsPrintingPath" value="blah.exe"/>
<add key="BCScannerPath" value="blah.exe"/>
<add key="SecuGenDeviceName" value="DEV_AUTO"/>
<add key="SecuGenPortAddress" value="USB_AUTO_DETECT"/>
<add key="SecuGenLiveTimeout" value="15000"/>
<add key="SecuGenImageQuality" value="50"/>
<add key="BCSPort" value="COM4"/>
<add key="BCSBaudRate" value="9600"/>
<add key="BCSParity" value="None"/>
<add key="BCSByteSize" value="8"/>
<add key="BCSStopBit" value="One"/>
<add key="BTicketBarcodeStartsWith" value="%B"/>
<add key="BTicketBarcodeEndsWith" value="."/>
<add key="TechSupportURL" value="blah"/>
</appSettings>
</configuration>
Here is also attached port error.
Now, I want to suppress this message box or I want to show this message in my custom message box.
I have a MVC 5 Project.
I want to use Roles.GetAllRoles().
But i get the System.Configuration.Provider.Exception.
I tryed to solve it with modifying the Web.Config, but i still get the error.
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<roleManager defaultProvider="CustomRoleProvider">
<providers>
<clear />
<add name="CustomRoleProvider" type="MyProjekt.CustomRoleProvider" />
</providers>
</roleManager>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.1" />
I also tryed to add
<roleManager
enabled="true"
cacheRolesInCookie="true" >
but then i get
An exception of type 'System.Web.HttpException' occurred in
System.Web.dll but was not handled in user code
Additional information: No Connection with SQL Server-Database.
I got caught out by this for a while Roles.IsUserInRole("Admin") which sent me down the route of looking for role providers etc. I should of just been using User.IsInRole("Admin")
the following was a usefull article in enabling roles
http://geekswithblogs.net/MightyZot/archive/2014/12/28/implementing-rolemanager-in-asp.net-mvc-5.aspx
I know this maybe does not pertain specifically to your question, but I just discovered how to find the Role a particular User is assigned to:
Dim userInfo = UserManager.FindById(User.Identity.GetUserId())
Dim userRole As String = userInfo.Roles(0).RoleId
Dim thisRole As String = db.Roles.Where(Function(x) x.Id = userRole).FirstOrDefault().Name
That was bugging me for a while so I just had to get it out there!
I have asp.net mvc 4 project where try to use transform config, where have some default values and when I try to change to release mode some default values change to release values, but it isnt work. When I try to change to release mode and build application I have nothing changes. Here is my default values in Web.config:
<appSettings>
<add key="appId" value="####"/>
<add key="appSecret" value="####"/>
<add key="hostName" value="####"/>
</appSettings>
And here is what I have in my Web.Release.config:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="appId" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(name)" />
<add key="appSecret" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
<add key="hostName" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</appSettings>
</configuration>
Does anybody help me?
Using xdt:Locator="Match(name)", you're trying to match an attribute name which does not exist. You're looking for key for the appSettings:
<add key="appId" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="appSecret" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="hostName" value="!!!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
I'm trying to authenticate users through LDAP in C#. Each time I try to log in, I get the 'Input string was not in a correct format' error.
This is my connection string:
<connectionStrings>
<add name="MyConnectionString" connectionString="LDAP://123.193.111.22:389.local" />
</connectionStrings>
<system.web>
<roleManager enabled="true" />
<membership defaultProvider="MyMembershipProvider"><providers>
<add name="MyMembershipProvider"
connectionStringName="MyConnectionString"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionUsername="MyUsername"
connectionPassword="MyPassword"
connectionProtection="Secure"
enableSearchMethods="true" />
</providers>
</membership>
<trust level="Full" />
</system.web>
<authentication mode="Forms">
<forms name=".ADAuthCookie" loginUrl="~/Admin/Login"
timeout="450" slidingExpiration="false" protection="All"/>
</authentication>
The error seems to be at type="System.Web.Security.ActiveDirectoryMembershipProvider. Any suggestions would be greatly appreciated. Thanks!
I've managed to figure it out. Had to rework the membership provider code and now I'm able to authenticate users.
I am about to change an existing application from using SQL Server Express to SQL Server CE 4, and so far I have successfully converted the data and implemented an SqlCeMembershipProvider.
Now I can create new users and they are able to login, but all existing users cannot login. I am using the same machineKey in both the new and old application and all I have changed in my membership and roleManager in my config-file is the type (changed to ErikEJ.SqlCeMembershipProvider).
<machineKey validationKey="xxx" decryptionKey="yyy" validation="SHA1" decryption="AES" />
<membership defaultProvider="SqlCeMembershipProvider" hashAlgorithmType="SHA1">
<providers>
<clear />
<add name="SqlCeMembershipProvider" type="ErikEJ.SqlCeMembershipProvider" connectionStringName="myDB" applicationName="myapp" requiresQuestionAndAnswer="false" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0"/>
</providers>
</membership>
<roleManager defaultProvider="SqlCeRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
<providers>
<add name="SqlCeRoleProvider" type="ErikEJ.SqlCeRoleProvider" connectionStringName="myDB" applicationName="myapp" />
</providers>
</roleManager>
Any ideas how to get old users back online?