|
I haven't worked with AngualJS 2.0 at all but the error message seems to indicate that it cannot find your include file, Manager.ttinclude. If it is on your desktop then it may not have permission to get to it since the website is probably not running with an account that would have access to your desktop.
I suggest moving code into a folder, perhaps c:\code and setting proper permissions on it.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I don't know the reason but when I closed the VS and opened it back this error has gone, but other errors still showing up though. I wish all script-configuration related errors could go like this .
Any idea for these errors buddy? these are the only errors remaining right now
The OutputLogFile parameter is not supported by the VsTsc task. Verify the parameter exists on the task, and it is a settable public instance property
The VsTsc task could not be initialized with its input parameters
But when I am running the application its giving me the following error:
Build:Unknown compiler option listemittedfiles. BSCSecurityAddressBookWeb C:\Users\aaleem01\Desktop\Angular2Apps\BSCSecurityAddressBookWeb\BSCSecurityAddressBookWeb\tsc
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 20-Mar-17 20:21pm.
|
|
|
|
|
I wrote my own identity attribute for MVC, but it has 1 flaw in it.
So when I create links to the users account, if they haven't logged in, the attribute catches it and redirects them to login.
In the attribute, I change the filter context to RedirectToRouteResult and send them to Login.
But after they login, they return to the original page and not the page I sent them to in the first place.
I guess I'm looking for a way to capture the original destination and pass it to the Login Page, so the controller can move them on their way to the proper destination.
I've seen Amazon do it in a query string. Any thoughts?
So this is a OnActionExecuting call
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary{
{ "controller", "Account" },
{ "action", "SignIn" }
});
If it ain't broke don't fix it
|
|
|
|
|
I googled around and didn't find anything on the subject.
Then while I was thinking about creating the route, I thought that there must already be a route that can be captured every time the attribute fires. The destination I was sending them to in the first place.
Thus ...
string rUrl = "/" + (string)filterContext.RouteData.Values["controller"] + "/" + (string)filterContext.RouteData.Values["action"];
Then while experimenting with creating the new route, I just added another key value pair.
So on OnActionExecuting()
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary{
{ "controller", "Account" },
{ "action", "SignIn" },
{ "rUrl", rUrl }
});
My SignIn program already had the mechanics to handle the rUrl query string so that was not a problem.
This is really cool at the moment unless it backfire on me later down the road.
I think this is going to bite me back if I send the user to simply login and return to the same page.
I need to figure out how to read a query string, perhaps that would be in the route values as well.
[Edit]
I like this version now. For some reason this puts a big smile on my face!
The ability to write these attributes in MVC is amazing. Saves so much work in the long run.
string rUrl = filterContext.HttpContext.Request.QueryString["rUrl"] != null ? (string)filterContext.HttpContext.Request.QueryString["rUrl"] : null;
string goUrl = "/" + (string)filterContext.RouteData.Values["controller"] + "/" + (string)filterContext.RouteData.Values["action"];
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary{
{ "controller", "Account" },
{ "action", "SignIn" },
{ "rUrl", rUrl != null ? rUrl : goUrl }
});
If it ain't broke don't fix it
modified 16-Mar-17 17:30pm.
|
|
|
|
|
Please provide me the simple website in which my problem will solved
|
|
|
|
|
Excel interop (or any Office interop) is not supported on asp.net. Look at the XML SDK or the Excel ODBC driver.
|
|
|
|
|
Member 13062652 wrote: Please provide me the simple website in which my problem will solved www.google.com[^]
|
|
|
|
|
I know that there are many answers on google, I tried many but nothing worked! I have a CodeMirror text editor and a list of files.I want to display the contents of a file when click on it.This is my first time using Javasctipt so I can't figure out what's wrong with my code.
This is the code I wrote so far:
controller:
public ActionResult Index()
{
StudentsCodes model = new StudentsCodes();
model.Student = (Student)CurrentUser;
var user = UserManager.FindById(((Student)CurrentUser).InstructorID);
model.Instructor =(Instructor) user;
return View(model);
}
public PartialViewResult DevelopmentPartial (StudentsCodes path )
{
return PartialView(path);
}
Main view:
<script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-3.1.1.js"></script>
<ul id="tree">
@foreach (var file in Directory.GetFiles(Server.MapPath("~/Content/" + Model.Student.UserName + "/CompilerProject/" + name)))
{
var filename = Path.GetFileName(file);
<li id="filelist" onclick="@(Model.path = "~/Content/" + Model.Student.UserName + "/CompilerProject/src/" + @filename)">
@filename
/li>
}
<div id="partial">
@{
Html.RenderPartial("DevelopmentPartial",null);
}
</div>
<script>
$(document).ready(function () {
$("#filelist").click(function (e) {
@{Html.RenderAction("DevelopmentPartial", Model);
}
});
});
</script>
PartialView:
@using (Html.BeginForm())
{
var fileContents= "";
if (Model==null)
{
fileContents = "";
}
else
{
fileContents = System.IO.File.ReadAllText(Server.MapPath(Model.path));
}
@Html.TextArea("code", fileContents, new { id = "code" })
}
The result was a non-clickable list elements , 3 text editors overlap each other, and display only the contents of the last file in the list. What am I doing wrong?
|
|
|
|
|
[Disclaimer: I use this to attach events for Html rendered via ajax]
Two things you may want to try here.
You should not have multiple elements with the same id but you can have multiple elements with the same class.
Use .on to attach events for partially rendered html.change <li id="filelist" to <li class="filelist" change $("#filelist").click(function (e) { to $(".filelist").on("click", function (e) {
_______________________________________________________________
Ah don't lean on me man, cause you can't afford the ticket
|
|
|
|
|
Still getting the same result. Looks like codeproject doesn't allow me to upload a picture, but the web page currently has three CodeMirror editors, all of them display the contents of the last file in the list.
The files in the list are still not clickable.
EDIT:
I modified the script :
<pre><script>
$(document).ready(function () {
$(".filelist").click(function (e) {
$('#partial').load("DevelopmentPartial")
@{
}
});
});
</script>
Now it refreshes the partial view but it doesn't display the contents of the files, even though I update Model.path onclick.
modified 17-Mar-17 4:46am.
|
|
|
|
|
To add the event in partial rendering - notice the '.on' construct
$(".filelist").on("click", function (e) {
_______________________________________________________________
Ah don't lean on me man, cause you can't afford the ticket
|
|
|
|
|
Stil doesn't display the contents of the file once clicked. It displays an empty editor.
I'm updating my model here:
<li class="filelist" onclick="@(Model.path = "~/Content/" + Model.Student.UserName + "/CompilerProject/src/" + @filename)">
Is that wrong?
|
|
|
|
|
I am rewriting an old website created, I think, using Visual Studio 2010 and am now using Visual Studio 2017. The old website had a command
Html.RenderPartial( "~/Counter/counter.ascx", new ViewDataDictionary { { "digits", 6 }, { "id", "RLSBC" } } ); which essentially displayed "id", the number of visits to the site, formatted as per "digits", 6 . The variable "digits" is a .gif file of the numbers 0-9 designed in a particular way and id was displayed as a 6 digit number using digits.gif.
That statement does not work in VS 2017. It gives me an error message that essentially states that ViewDataDictionary cannot take zero parameters.
No doubt there will be other times I don't quite understand what it going on, so, is there a manual I can purchase which describes this and the other commands I will no doubt need as I progress. It would also be good if it described the use of Entity Framework, which I will need to access and SQL database.
|
|
|
|
|
Use Google to find the MSDN documentation.
|
|
|
|
|
xiecsuk wrote: is there a manual I can purchase which describes this and the other commands I will no doubt need as I progress. I find the easiest thing to do is to google the class. For example, google the error or just google ViewDataDictionary and you will probably get links to MSDN help and read through those.
I can't imagine there is a manual that will walk you through what you are doing.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
xiecsuk wrote: essentially states that ViewDataDictionary cannot take zero parameters
That's odd, because MSDN[^] says that it can. Can you post the full error message?
As an alternative, you should be able to pass an anonymous object instead of a ViewDataDictionary :
Html.RenderPartial( "~/Counter/counter.ascx", new { digits: 6, id: "RLSBC" })
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The message says
'viewDataDictionary does not contain a constructor that takes 0 arguments' The problem is that MSDN isn't detailed enough. It doesn't say anywhere I could find that Html.RenderPartial should be prefixed with @ sign. That was the first thing that caused me problems. Under VS 2010, it started with <%.
And my requirements have now changed a bit. ~/Counter/counter.ascx used to count the number of visitors and overwrite the value in RLSBC.txt. I have moved that function to Start.cs to make sure it is only run once per visit. (The old method used to be run more than once per visit.) The viewDataDictionary part took id (the current number of visits) in RLSBC (RLSBC.txt) and display it as 6 characters using digits (digits.gif). Digits.gif and RLSBC.txt are both in the wwwroot/Counter directory.
Is HTML.RenderPartial / viewDataDictionary still the correct way to achieve my goals?
|
|
|
|
|
xiecsuk wrote: viewDataDictionary
That doesn't match the code you posted, which was using the ViewDataDictionary class. (Note the upper-case "V" at the start, which is lower-case in your error message.)
xiecsuk wrote: Html.RenderPartial should be prefixed with @ sign. That was the first thing that caused me problems. Under VS 2010, it started with <%.
It sounds like you've switched between view engines - you were using the older ASPX view engine, and you're now using Razor.
ScottGu's Blog - Introducing “Razor” – a new view engine for ASP.NET[^]
Introduction to ASP.NET Web Programming Using the Razor Syntax (C#) | Microsoft Docs[^]
xiecsuk wrote: Is HTML.RenderPartial / viewDataDictionary still the correct way to achieve my goals?
It sounds to me like your partial view was doing too much. The code to update the counter should not be in a view, so you've done the right thing moving it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You're right; it does start with V and not v .
Thank you so much for the two web references. That is just what I was looking for; something that gave more detail than is provided by using Peek Definition or Go To Definition off the mouse button 2 menu.
I will read through them, learn and hopefully improve my website.
Now I need to understand how to format my counter using the .gif definition.
|
|
|
|
|
I create a web page with asp.net using visual.studio. And I need to acquire data from my website and save it to my computer, in a particular folder. How can I do this? Should I write this part of the program in 'Site.Master.cs' or can you tell me more exactly what I have to do, please?
NetworkAcquisitionDevice device = new NetworkAcquisitionDevice("100.0.0.1",51212,30);
FrameSearcherSecond frameSearcher = new FrameSearcherSecond();
FormatterXorByte formatterCust = new FormatterXorByte();
DataAcquisition daq = new DataAcquisition(device, frameSearcher, formatterCust);
daq.EnableDataFormatting(true);
daq.EnableFrameSearching(true);
daq.EnableDataWriting(true); // data wil be in your harddisk.
daq.StartAcquisition();
bool stop =false;
while (!stop)
{
byte[] dataFromDevice= daq.GetData();
//process data here
}
daq.StopDataAcquisition();
daq.Reset(); // it will reset all parameters.
|
|
|
|
|
I do not understand where you are stuck.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have a web application where I have a template (word) which I need to open/save and replace some values at run time. How do I do this?
|
|
|
|
|
|
If it's a new-format file (.docx ), then you'll need to use something like DocX[^] or the Open XML SDK 2.5 for Office[^].
If it's an old-format file (.doc ), then you'll struggle to find a non-commercial library to manipulate it.
NB: Don't be tempted to try Office Interop; aside from needing an Office license for your server, it's not supported in ASP.NET:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Below is my code. I can't figure out how to find specific text and replace it
Dim byteArray As Byte()
Dim myDataTable As DataTable = objDB.GetTemplates(plan.YearCode, "Templates", plan.State)
If Not myDataTable Is Nothing AndAlso myDataTable.Rows.Count > 0 Then
byteArray = DirectCast(myDataTable.Rows(0).Item("Template"), Byte())
Else
Throw New Exception("Unable to retrieve the specified template")
End If
Using mem As MemoryStream = New MemoryStream
mem.Write(byteArray, 0, CInt(byteArray.Length))
Using doc As WordprocessingDocument = WordprocessingDocument.Open(mem, True)
??? How do I find specific word and replace it
Helper.DownloadStream("Schedule" &" .docx", mem, Helper.WORD_CONTENT_TYPE)
End Using
End Using
|
|
|
|