|
Beginner asking a question before he makes a recommendation to his boss!!!
I have been tasked with fixing a database issue for my company and I need to ensure I am on the right track so I am asking here for confirmation.
Our current process is we use two forms for input into our database.
A registration form on Wordpress and a Facebook leads form
We take the information from there and we input it into Zoho and a Mysql database behind a Wordpress web portal.
The file format we use is CSV. My understanding of CSV is that the data fields have to match the database table. If there is a column mismatch between the file and the database, data will go into the wrong field unless it is processed in some form to move the column in the CSV file. That is my understanding. Am I correct in this?
So, if my above assumption is correct, then it would be logical that the forms used would need to be standardised in order to ensure the data format is standardised. Please let me now if I am on the right track with this. Thanks
|
|
|
|
|
Yes you are on the correct track with this info. If you are importing directly from the CSV then the file format MUST match the database fields. You could write a parser which does the importing for you, this would give you an opportunity to trap crappy data before it hits your DB.
CSV has some gotchas, if it is not well formed, dealing with commas in the data, then you are in big trouble.
"Form" implies a standardised format otherwise it is just free form text.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I have to write ASP .NET code that allows for a user to only have one application session active at a time. What the code needs to do is logout an existing user, or session, if the same user logs into the same application in a different browser. In other words the new session should kill the old or existing session. Has anyone done this before? One note is that I am using Windows authentication and not Forms.
modified 18-Nov-18 15:07pm.
|
|
|
|
|
holdorf wrote: One note is that I am using Windows authentication and not Forms.
It's almost impossible to sign out if you're using Windows authentication. In most cases, the only way to accomplish it is to restart the browser.
One possible option:
- In a database, map the username to a Guid representing their "active session";
- In the "authorize request" event, check for the existence of a custom cookie:
- If the cookie exists, verify that its value matches the user's "active session" value in the database, and allow or deny the request as required;
- If the cookie doesn't exist, change the user's "active session" value in the database, and set a session cookie on the response with the new value;
Once a user has been kicked off by signing in on another browser or device, they will need to restart their browser to sign in again.
NB: Certain browser settings may cause the browser to retain session cookies even after a restart, which would mean the user would have to manually clear the cookies for your site to sign in again. This affects both Chrome[^] and Firefox[^], and possibly others.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello,
i am trying to make a REST server with and a client with an oData service.
The server is running and with the restlet tool i can send request and receive the correct information.
the debug from the restlet tool looks:
{
"name": "Microsoft.ApplicationInsights.Dev.Request",
"time": "2018-11-17T19:36:06.4656803Z",
"tags": {
"ai.internal.sdkVersion": "web: 2.0.0.25000",
"ai.device.roleInstance": "Kodi-PC",
"ai.location.ip": "192.168.2.146",
"ai.operation.name": "GET Employees [id]",
"ai.operation.id": "3sUDPXBnJTQ="
},
"data": {
"baseType": "RequestData",
"baseData": {
"ver": 2,
"id": "3sUDPXBnJTQ=",
"name": "GET Employees [id]",
"startTime": "2018-11-17T19:36:06.4656803+00:00",
"duration": "00:00:00.6869570",
"success": true,
"responseCode": "200",
"url": "http://192.168.2.21:3000/api/Employees/2",
"httpMethod": "GET",
"properties": {
"DeveloperMode": "true"
}
}
}
}
but the debug from the oData client looks:
{
"name": "Microsoft.ApplicationInsights.Dev.Request",
"time": "2018-11-17T19:39:47.1503444Z",
"tags": {
"ai.internal.sdkVersion": "web: 2.0.0.25000",
"ai.device.roleInstance": "Kodi-PC",
"ai.location.ip": "192.168.2.21",
"ai.operation.name": "GET employees(2L)",
"ai.operation.id": "gt/hDaz3z0A="
},
"data": {
"baseType": "RequestData",
"baseData": {
"ver": 2,
"id": "gt/hDaz3z0A=",
"name": "GET employees(2L)",
"startTime": "2018-11-17T19:39:47.1503444+00:00",
"duration": "00:00:00.0163775",
"success": false,
"responseCode": "404",
"url": "http://192.168.2.21:3000/api/employees(2L)",
"httpMethod": "GET",
"properties": {
"DeveloperMode": "true"
}
}
}
}
i'am new in this type of development,
it think it is by routing or filter,
Is there someone who can help me out of this problem
Kind regards
Roger
|
|
|
|
|
|
Thanks for the response,
you can see the working url coming from the restlet tool is different
"url": "http://192.168.2.21:3000/api/Employees/2" as the url from de odata client that i have made
"url": "http://192.168.2.21:3000/api/employees(2L)"
I made the REST server on the example www.youtube.com/watch?v=LpySuvYPMZQ">REST MySQL - Build a REST Service in Visual Studio 2015
in the client app i used
Application1.db.employees.byKey(e.itemIndex).done(function (data) {
employee.fromJS(data);
isReady.resolve();
});
my question is, where and how do i need to change my client app that the request of the oData client works with the REST server
modified 18-Nov-18 7:55am.
|
|
|
|
|
Hi,
Is there anyway, I can add all the dlls that are required for the application deployment be automatically added by Nuget, means when I am deploying the application, a tool that can warn me or let me know that this dll is missing from the deployment, if it can be done by nuget itself, it would be a great help.
I am asking this because a serious issue happened in my application deployment, reportviewerforMVC tool that uses the MicroSoft.Sql.Types dll was missing but deployment was happening, it took me considerably long time to identify what was the problem, because ReportViewerForMVC was not giving me any error message.
Please need some help any help would be very very greatful - thanks a lot friends.
modified 21-Nov-18 12:12pm.
|
|
|
|
|
I have InProc Session mode set to 20 min(web.config),
If the user is inactive after 20 min user gets logged off and that's fine but
i also want to check after 10min of user inactivity sql table value has to be updated.How to handle this?
|
|
|
|
|
Could take a look at web backgrounder https://github.com/NuGet/WebBackgrounder
Very basic and simple task runner. Check the related NuGet packages. For anything complex use quartz.net.
|
|
|
|
|
At the moment i'm using javascript timer but script(setInterval) is not applying on navigating among pages.
Can't I apply script all over app and run timer in background?
|
|
|
|
|
If you're using IIS, you don't. IIS will arbitrarily kill your process when it's not actively receiving requests, which will kill your timer.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Hi,
I am getting the following Exception, when I am trying to run my report on the Server, locally it is working fine, need some help please any help would be very helpful, thanks in advance my friends.
Error Message: Value cannot be null.
Parameter name: reportViewer
Error Source: ReportViewerForMvc
Error InnerException Message:
Error TargetSite: System.Web.HtmlString GetIframe(Microsoft.Reporting.WebForms.ReportViewer, System.Object)
Error StackTrace: at ReportViewerForMvc.ReportViewerForMvc.GetIframe(ReportViewer reportViewer, Object htmlAttributes)
at ASP._Page_Views_Report_ShowLegalEntityReport_cshtml.Execute() in c:\PIMS\Views\Report\ShowLegalEntityReport.cshtml:line 7
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.StartPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult)
Error Controller: Report
Error Action: ShowLegalEntityReport
My code to generate report is as below:
ReportViewer reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.SizeToReportContent = true;
reportViewer.Width = Unit.Percentage(900);
reportViewer.Height = Unit.Percentage(900);
DataRetrieveServiceClient drsc = new DataRetrieveServiceClient();
DataTable dt = CommonFunctions.ToDataTable(drsc.GetLegalEntityReport(legalEntityNumber, lENumOperator, legalEntityName, lENameOperator, taxId, taxIdOperator
, submittingCounty, submCountyOperator, legalEntityCity, lECityOperator));
reportViewer.LocalReport.ReportPath = Request.MapPath("~/Reports/LegalEntityReport.rdlc");
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("LegalEntityDataSet", dt));
reportViewer.LocalReport.Refresh();
ViewBag.ReportViewer = reportViewer;
return View();
Please let me know if I am doing any mistake, please help thanks my friends.
modified 15-Nov-18 13:36pm.
|
|
|
|
|
The problem seems to be in your view:
c:\PIMS\Views\Report\ShowLegalEntityReport.cshtml, line 7
Can you post that line of your view, and perhaps a few lines from either side?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Here is my code in the View, this is all I have, don't I have reference to ReportViewer added or some middle line in between the Controller Code is failing like Service Call etc which is making the ViewBag null, just not understanding, any help would be greatly helpful thanks my friend.
I just tested Report Path is also correct, I just put log and tested it, but the problem is, ReportPath is coming like this the Physical Path (C:\PIMS\Reports\LegalEntityReport.rdlc), this Physical Path is correct, I put the Virtual Path (full Path to report hard coded) also, in both cases it failed.
And another one I tested just now is that DataSet and DataTable both are not null values they have rows, so its not because I am passing null values, so it must be something related to setting in config etc.
I am not sure what's the reason for its failure, any config setting or etc, I don't know what it is, any help please
@using ReportViewerForMvc;
@{
ViewBag.Title = "Show Legal Entity Report";
Layout = "~/Views/Shared/_LayoutFinal.cshtml";
}
@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
modified 15-Nov-18 17:19pm.
|
|
|
|
|
Using Value as Type will return null if the value cannot be converted to the type.
Try using a cast instead, just in case the value is of the wrong type:
@Html.ReportViewer((Microsoft.Reporting.WebForms.ReportViewer)ViewBag.ReportViewer)
If you still get a NullReferenceException , then you'll need to debug your code to make sure you're actually setting the ViewBag value.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry Richard, it didn't fix the problem yet, is it because of any security hitch because we are using SSL on the Server or am I missing any other dll etc, I have all the dlls added and deployed on the Server, is it because using ReportViewerForMVC itself is a problem? I have not seen much support about that tool also and I don't know using it with SSL is bad combination, or SSL itself is a problem.
I have put the ignore Certificates code as well in Global.asax file, still not working, or just the Physical Path itself is a problem, but the report Viewers that are used by the iFrame are working fine in other applications - those applications are also using the MapPath code means Physical Path, they are on the same Server too, I thought this also works and internally this tool also uses a .aspx page just like their approach but in iFrame approach the code to generate report is written in the .aspx pages Code behind but in the ReportViewerForMVC the report generation code is written in the Controller, but not understanding Richard, not logging any information also.
MapPath is returning Physical Path, is it because of that, is it because Local not Remote, just don't know Richard, very sad in ending up in this way. If anybody can help me who gone through the same situations please help me, I really really thankful to you.
Quote: If you still get a NullReferenceException, then you'll need to debug your code to make sure you're actually setting the ViewBag value.
How can I do it on the Server Richard, I am seeing the DataSet and DataTable are not null, I am not getting any information why is it failing, any help would be great for me Richard.
modified 16-Nov-18 13:49pm.
|
|
|
|
|
You're getting a NullReferenceException for the reportViewew parameter.
Either ViewBag.ReportViewer is null , or it is not an instance of the Microsoft.Reporting.WebForms.ReportViewer class.
If you can't work out how to debug it, then temporarily change your view to output the type of the value:
@using ReportViewerForMvc;
@{
ViewBag.Title = "Show Legal Entity Report";
Layout = "~/Views/Shared/_LayoutFinal.cshtml";
}
@* Comment out this line: *@
@* @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer) *@
@if (ViewBag.ReportViewer == null)
{
<p>ReportViewer is not set!</p>
}
else if ((ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer) is null)
{
<p>ReportViewer is the wrong type: @ViewBag.ReportViewer.GetType()</p>
}
else
{
<p>Everything looks OK...</p>
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks a lot Richard.
I just saw it, ViewBag is not null hence it is displaying the text "Everything looks OK..." but, now its going to the home page of the application, is it because of the Path Problem or Security Problem not understanding. Just asking, can we put try catch in cshtml to catch an Exception if its raised and log it on a file or db or even at least JavaScript console is also fine or can I hard-code and assign a reports Virtual Path directly to the ReportViewer tool directly, then deploy and see if it is just the Path not being able to access. It seems like one of these two might be the problem clearly, any help my friend, please?
modified 16-Nov-18 14:10pm.
|
|
|
|
|
If you're getting "Everything looks OK", then you must be hitting an unknown bug in the ReportViewerForMvc library[^].
Make sure you're using the latest version. Triple-check that you've spelled the ViewBag.ReportViewer correctly in your view. If it still doesn't work, you'll have to raise an issue on GitHub[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hi Richard, yes you are very true, I changed the approach, I have used the iFrame approach I am getting the following error
An error occurred during local report processing.
The definition of the report 'C:\PIMS\Reports\LegalEntityReport.rdlc' is invalid.
An unexpected error occurred in Report Processing.
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
but the report is in the same path, is it something related to Path or any other library issue, can you please let me know, thanks a lot my friend.
|
|
|
|
|
You're missing the SQL Server spatial types assembly from your server.
You can download the installers from Microsoft and install them on the server:
Download Microsoft® SQL Server® 2012 Feature Pack from Official Microsoft Download Center[^]
(Links under Instructions ⇒ Microsoft® System CLR Types for Microsoft® SQL Server® 2012)
Or you can install v11 of the NuGet package[^], which will copy the files to your application so that you can copy them up to the server.
Install-Package Microsoft.SqlServer.Types -Version 11.0.0
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hurrayyyyyy !.... yes this fixed the problem, but still I don't understand why it didn't work with ReportViewerForMVC approach - just took lot of effort and stress my friend.
And thanks a lot for being with me, its great and absolutely great, you are awesome person - thanks a lot again.
|
|
|
|
|
hi Richard mate - one more thing I have identified, that ReportViewerForMVC is also working fine now, so was it the Microsoft.SqlServer.Types that was missing, if it is then why didn't the ReportViewerForMVC inform me in Exception or etc? Where as the iFrame approach has informed me so that I could able to fix the issue. It would have been easier if I would have known this dll that was missing, it left very bad impression around colleagues that it is simple and I am not able to fix the issue.
Thanks for helping me all the way along this issue mate. Hope you don't mind me calling you - mate 
modified 16-Nov-18 17:59pm.
|
|
|
|
|
simpledeveloper wrote: why didn't the ReportViewerForMVC inform me in Exception or etc?
Probably worth raising this as an issue on the GitHub project, so the developers can address it in a future release.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|