|
Would you please let me know how to code Remotedeskop system in Asp.net using C#
|
|
|
|
|
Hire someone. If you don't even have a starting point that level of detail and commitment required is likely beyond you.
Also there's a good open source solution, though not .NET based:
Apache Guacamole™
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
i try some types but not working,And how to solve this issue
|
|
|
|
|
Member 12780697 wrote: i try some types but not working What types? Do you mean types of a frameworks? Crystal Report is one of the most widely used framework.
Lastly, date to date is just a filter. Every reporting software/library provides options that can be configured to select a range of date values to get the report for. Which library are you using?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
please tell me all steps in details to implement https for mvc site
[RequireHttps]
public ActionResult Login(string redirectUrl) {…}
do i need to use [RequireHttps] ?
do i need to change any property of project?
do i need to bind certificate in IIS level to test it?
how to test https in my local pc?
please guide me with step-by-steps details.
|
|
|
|
|
It doesn't matter what kind of site you're running - MVC or Winforms - https is https and is a server (IIS) configuration issue - though you may need to ensure that any references to http in your CSS or JavaScript code are redirected accordingly - eg @imports in CSS or, for example, if you use a JavaScript library with an external source you may need to update the reference (or your users will see an "insecure content" warning in their browsers.)
You may also need to update callback references in, for example, Paypal if you use their Instant Payment Notifications, and in Google Analytics.
Otherwise you can enforce https within web.config - but you may want to ensure everything is working first. You can obtain free SSL certificates from Lets Encrypt[^] - if you're on a Windows server, I quite like the Certify[^] manager for getting and installing them.
There no real need to test it locally - as I say, you can test it on https while leaving plain http in place, until you're happy it's all working, and then enforce https (See below). If you really want to, you can though - but exactly how depends on your local setup. You'll need to open your router, and point a domain to your machine and bind that in ISS... etc etc.
Here is what I put in web.config to enforce https:
<system.webServer>
<rewrite>
<rules>
<rule name="httpsredirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
|
|
|
|
|
This, but I would add that server configuration is not a developer's job; that's the responsibility of the System Admins. Let them handle SSL configuration, and write your application in a way that will allow them to do that.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
True - but some of us poor sods have to be responsible for both...
|
|
|
|
|
Same boat, but they are definitely separate roles and I hold out hope that some day...
Regardless, it's a practices issue in my book. I like the [RequireHttps] in theory, but I don't like setting the standard that server configuration should be in the hands of the dev. More to the point, using that construct leaves it up to the dev which information should be protected and which is freely available, and that's very bad practice. What if you forget to tag a controller or method with [RequireHttps], when in reality the server admin should really be setting a redirect? I don't intend to be liable for those decisions, that's why management makes the big bucks.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
A_Griffin wrote: MVC or Winforms
Should that perhaps be "MVC or Webforms"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
WinWebForms?
|
|
|
|
|
i have a ASP.Net MVC project where i can integrate elmah but the problem is my project solution has many projects like asp.net mvc, BAL, DAL. if i integrate elmah in asp.net mvc project then i will not be able to log error by elmah from DAL or BAL. i want to log error from any project and for that i need to implement elmah in separate project.
i read two write up but still could not figure out the way to achieve my goal. those urls are
https://dzone.com/articles/writing-custom-error-loggers-for-elmah
https://www.codeproject.com/Articles/566705/Making-elmah-axd-a-log-viewer-for-multiple-applica
i am following first article link. they said we need to install elmah core library which i did and also i create a class file
ElmahLog : Elmah.ErrorLog extending Elmah.ErrorLog and override few elmah functions.
now do not understand what to write inside those function.
here is the code
public class ElmahLog : Elmah.ErrorLog
{
public override string Log(Error error)
{
throw new System.NotImplementedException();
}
public override ErrorLogEntry GetError(string id)
{
throw new System.NotImplementedException();
}
public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
{
throw new System.NotImplementedException();
}
}
so please tell me how to log error from the above function into sql server db. also tell me how to incorporate elmah.axd log viewer in asp.net mvc project to view all error which logged from my UI,DAL and BAL.
please tell me what config entries i need to add in mvc project and separate project where i add elmah core.
please guide me if anyone did it before.
|
|
|
|
|
This isn't the answer, but I would imagine that you make the Elmah project the first project in the dependency list in solution explorer.
Then add that project as a dependency (reference) in your DAL project. DAL would reference the Elmah project.
Then start stacking projects on top of the DAL project, since all projects will require the DAL.
Now set your build order for Elmah first, Dal 2nd, and then the rest of your projects.
I have a large MVC project that I stacked in the same manner, and I have the MVC controller separated from the main MVC project.
So My project build order is:
DAL with Automatic Migration and Database Seeding.
Entities - Shared EF Database Calls
Common stuff
Services - like Card Processing and Ship Rates
Controllers
MVC Project
If it ain't broke don't fix it
|
|
|
|
|
Is there any resolution for this error: System.IndexOutOfRangeException: RetryAttempts
for this syntax? I am getting this error when I input the right username and password. Why is "retryattempts" giving me an error? Please help!
int retryattempts = Convert.ToInt32(dr["retryattempts"]);
|
|
|
|
|
Not seeing the whole piece of code ... it looks like you are try to reference a column called, "reryattempts", maybe from a datarow and that column does not exist.
Try something like dr.items.count to see how many columns are present.
|
|
|
|
|
Thanks for your response! Here is the entire code.
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("sp_AuthenticateUser", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter paramUsername = new SqlParameter("@Username", username);
SqlParameter paramPassword = new SqlParameter("@Password", password);
cmd.Parameters.Add(paramUsername);
cmd.Parameters.Add(paramPassword);
con.Open();
// int ReturnCode = Convert.ToInt32(cmd.ExecuteScalar());
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int RetryAttempts = Convert.ToInt32(rdr["RetryAttempts"]);
if (Convert.ToBoolean(rdr["AccountLocked"]))
{
lblMessage.Text = "Account is locked. Please contact your Web Administrator!";
}
else if (RetryAttempts > 0)
{
int AttemptsLeft = (4 - RetryAttempts); // allow 4 attempts
lblMessage.Visible = true;
lblMessage.Text = "Invalid username and/or password. " +
AttemptsLeft.ToString() + " attempt(s) left";
}
else if (Convert.ToBoolean(rdr["Authenticated"]))
{
FormsAuthentication.RedirectFromLoginPage(txtUser.Text, chk_Remember.Checked);
Response.Redirect("../index.aspx");
}
}
}
|
|
|
|
|
|
If you're getting an IndexOutOfRangeException on the line int RetryAttempts = Convert.ToInt32(rdr["RetryAttempts"]); , that means your query is not returning a column called "RetryAttempts".
You'll need to examine your stored procedure to see what columns it's actually returning, and either fix the column name in your code, or fix the column name in your stored procedure.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for telling me to check my stored procedure. I discovered there is a typo in my stored procedure. I had it as "RetyAttempts".
Million Thanks! Merry Christmas!!
|
|
|
|
|
Lay_Kay wrote: System.IndexOutOfRangeException: RetryAttempts The message is telling you that the value in RetryAttempts (which is a different variable than retryattempts ) does not contain a valid index for the list or array that it references. We need to see the code where the error occurs.
|
|
|
|
|
Greetings again,
I am really struggling to get my code to work.
have a gridview with ID = Gridview1.
This gridview has three textboxes and one checkbox with id = grid1Details
The requirements:
if => checkbox is unchecked and textboxes are empty => You cannot submit your form
if => checkbox is checked and textboxes are empty => You can submit your form
if => checkbox is unchecked and textboxes are not empty => You can submit your form
By default, upon page load, checkbox is unchecked and textboxes are enabled.
How do I modify the following code to make this work?
Protected Sub Grid1CheckChanged(ByVal sender As Object, ByVal e As EventArgs)
'Dim hasBlank As Boolean = False
For Each row As GridViewRow In Gridview1.Rows
Dim ename As TextBox = TryCast(row.FindControl("txtsourcename"), TextBox)
Dim empaddress As TextBox = TryCast(row.FindControl("txtsourceaddress"), TextBox)
Dim empincomesrc As TextBox = TryCast(row.FindControl("txtsourceincome"), TextBox)
Dim sourceCheck As CheckBox = DirectCast(Gridview1.FindControl("grid1Details"), CheckBox)
If Not sourceCheck.Checked Then
'hasBlank = True
ename.Enabled = True
empaddress.Enabled = True
empincomesrc.Enabled = True
ElseIf Not sourceCheck.Checked And ename.Text Is Nothing And empaddress.Text Is Nothing And empincomesrc.Text Is Nothing Then
lblStatus.Text = "Please either fill out the textboxes or check the checkbox."
Else
ename.Enabled = False
empaddress.Enabled = False
empincomesrc.Enabled = False
End If
Next
End Sub
JavaScript would probably be better but my attempt at using JavaScript has not worked so far.
Below is my attempt at javascript:
<script type="text/javascript">
function ValidateTextBox() {
checkbox = document.getElementById("grid1Details");
var textvalue = $(".textClass").attr('value');
if (!checkbox.checked && textvalue != "") {
alert("Either check the box or enter value in all textboxes.");
return false;
}
return true;
}
</script>
//markup:
<td> <asp:Button ID="btnNext" CssClass="btnNext" runat="server" Text="Review Form" OnClientClick="BtnClick();javascript:return ValidateTextBox();" OnClick="btnNext_Click" /></td>
<table>
<tr>
<td>
<asp:gridview ID="Gridview1" gridlines="None" runat="server" ShowFooter="true" AutoGenerateColumns="false" OnRowDeleting="Gridview1_RowDeleting">
<Columns>
<asp:BoundField DataField="RowNumber" Visible="false" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Name">
<headerstyle horizontalalign="Left" />
<ItemTemplate>
<asp:TextBox ID="txtsourcename" CssClass="textClass" placeholder="Name...(e.g, Jane Doe)" runat="server" style="width:250px;" class="form-control"></asp:TextBox><br />
<asp:CheckBox ID="grid1Details" ClientIDMode="Static" runat="server" Checked="false" AutoPostBack="true" OnCheckedChanged="Grid1CheckChanged" /><span style="color:#ff0000">*Check this box if N/A</span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtsourceaddress" CssClass="textClass" placeholder="Address..." runat="server" style="width:250px;" class="form-control"></asp:TextBox><br /><br />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Income">
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtsourceincome" CssClass="textClass" placeholder="Income...(example: 1000)" runat="server" style="width:250px;" class="form-control txtsourceincome numeric"></asp:TextBox><br /><br />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
onclick="ButtonAdd_Click" CssClass="grvAddButton" OnClientClick="return ValidateEmptyValue();return validate()" /><br /><br /><br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="sourceDelete" runat="server" Text="Delete" CommandName="Delete"
CssClass="grvDelButton" OnClientClick="return confirm('are you sure?')" /> <br /><br /><br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
</table>
Thanks in advance
modified 18-Dec-17 15:01pm.
|
|
|
|
|
Hi,
I am creating an Asp.Net MVC5 application where I have two areas called Teacher and Parent. I want to display a Child's home page based on the area, that is, both the teacher and parent have their own page layout. I can pull the child data using json. How can display it as a partial view in both parent and teacher home page?
Thanks
|
|
|
|
|
I find many discussions, but none work with more div
<pre><script type="text/javascript">
window.onload = function scr1() {
var div = document.getElementById("dvScroll");
var div_position = document.getElementById("div_position");
var position = parseInt('<%=!string.IsNullOrEmpty(Request.Form["div_position"]) ? Request.Form["div_position"] : "0" %>');
div.scrollTop = position;
div.onscroll = function () {
document.getElementById("div_position").value = div.scrollTop;
};
};
</script>
<pre> <form id="form1" runat="server">
<div id="dvScroll"; style="width:450px; height:300px; overflow:scroll; float:left">
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnRowDataBound="GridView1_RowDataBound" OnRowCreated="GridView1_RowCreated" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="4">
<Columns>
<asp:BoundField DataField="ID_NAVE" HeaderText="IdNave" ItemStyle-Width="50" ItemStyle-wrap="false" Visible="true" />
....
</Columns>
</asp:GridView>
</div>
<input type="hidden" id="div_position" name="div_position" />
the DIV dvscroll with the HiddenField
<pre><form id="form1" runat="server">
<div id="dvScroll"; style="width:450px; height:300px; overflow:scroll; float:left">
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnRowDataBound="GridView1_RowDataBound" OnRowCreated="GridView1_RowCreated" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" CellPadding="4">
<Columns>
<asp:BoundField DataField="ID_NAVE" HeaderText="IdNave" ItemStyle-Width="50" ItemStyle-wrap="false" Visible="true" />
....
</Columns>
</asp:GridView>
</div>
<input type="hidden" id="div_position" name="div_position" />
<div id="dvScroll2"; style="clear:both; width:600px; height:300px; overflow:scroll;">
<asp:HiddenField ID="HiddenField2" runat="server" />
<asp:GridView ID="GridMnuRest" runat="server" AutoGenerateColumns="false" CellPadding="4" OnRowCreated="GridMnuRest_RowCreated" OnRowDataBound="GridMnuRest_RowDataBound" OnSelectedIndexChanged="GridMnuRest_SelectedIndexChanged" OnSelectedIndexChanging="GridMnuRest_SelectedIndexChanging" OnRowCommand="GridMnuRest_RowCommand">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox ID="MnuSelect" runat="server" AutoPostBack="true" OnCheckedChanged="GridMnuRest_OnCheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id_ristorante" HeaderText="IdRst" ItemStyle-Width="20" ItemStyle-wrap="false" Visible="true" />
</Columns>
</asp:GridView>
</div>
<input type="hidden" id="div_position2" name="div_position2" />
</form>
as you can do for 2 or more DIV ?
|
|
|
|
|
|
The post script with only one div works, but you can do it better and make it easier to manage.
The new solution
combination with ScriptManager and UpdatePanel components.
1) create a DIV at level Body
2) create script reference for WebForm.js
3) create a DIV for GridView
4) add a UpdatePanel
5) declare structure GridView
important, without update panel the position after a Postback is not maintained
<body style="height: 857px">
<form id="form1" runat="server">
<!-- General DIV for page -->
<div>
<!-- Script Manager -->
<asp:ScriptManager ID="ScriptManager2" runat="server">
<Scripts>
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
</Scripts>
</asp:ScriptManager>
<!-- DIV for Grid master -->
<div id="dvScroll"; style="width:450px; height:300px; overflow:scroll; float:left">
<!-- UpdatePanel for UpdatePostback -->
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<!-- Grid Master -->
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CellPadding="4" OnRowCreated="GridView1_RowCreated" OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="ID_NAVE" HeaderText="IdNave" ItemStyle-Width="50" ItemStyle-wrap="false" Visible="true" />
<asp:BoundField DataField="NOMENAVE" HeaderText="nave" ItemStyle-Width="15" ItemStyle-wrap="false" Visible="true" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
for other GrdiView , is the same
<pre> <div style="width:450px; float:left; height:300px; overflow:scroll;">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:GridView ID="GridRest" runat="server" AutoGenerateColumns="false" CellPadding="4" OnRowCreated="GridRest_RowCreated" OnRowDataBound="GridRest_RowDataBound" OnSelectedIndexChanged="GridRest_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="id_restaurant" HeaderText="IdRst" ItemStyle-Width="50" ItemStyle-wrap="false" Visible="true" />
<asp:BoundField DataField="restaurantname" HeaderText="Restaurant" ItemStyle-Width="15" ItemStyle-wrap="false" Visible="true" />
<asp:BoundField DataField="suite" HeaderText="Suite" ItemStyle-Width="100" ItemStyle-wrap="false" Visible="true" />
</Columns>
<HeaderStyle BackColor="gray" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
|
|
|
|