|
Can someone point me in the right direction on how to do the following?
I need to create a small desktop application that uses FileSystemWatcher to look for file creation. When a file has been detected, it uploads the file to a server (Web API). So far so good.
Here comes the problem: The file(s) need to attach themselves to the 'page' the current user is on.
A user creates a 'New Page' on our website, fills in some information and then imports files that our FileSystemWatcher detects. Somehow the Web API need to find what session the user is on and attach the files to this session and then display the files/images on the current 'page'.
My idea is to add another cell to the user table in the database called "CurrentSession", that holds a uniqueidentifier (pointing towards the PageId). But this Id needs to be cleared if the user leaves the page, closes the browser, disconnects, log-out and so on. It's vital that the files do not attach themselves to the wrong page.
Am I over thinking this? Or is there a better way to achieve this?
|
|
|
|
|
I am not sure how feasible clearing Id would be..
But I think, you can definitely maintain the "CurrentSession" unique identifier on client (website page) as well and send this along and validate with the one stored in database. This way you do not need to take care of different ways the user is moving away.
hope this helps..
|
|
|
|
|
The problem is that the files need to go to a specific page and not a specific user.
A user can have thousand of pages, that's why the files should only be transferred IF the user is on a specific page. If they are doing anything else on the website, then the CurrentSession should be null, and the file transfer application will inform the user about it.
So the fail-safe is that if there's no active 'Page' on the customer that is trying to upload files, the application will inform the customer to go and create it and be Active on the Page.
Guess this has to be done by using a service to check for user activity or something...
|
|
|
|
|
ZilverZtream wrote: Or is there a better way to achieve this?
Let the user select the files to upload from within the website. It's the only way to be sure they're attached to the page the user is editing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That would have been nice.. the problem is that the device(s) the client use for image/file -transfers, usually save the files with things like guid names in folders that can contain thousand of other files.
For the user to select the file(s) (between 4-30 files) the device just transferred, in a folder with 1000's of other files with obscure file names, will probably not be ideal. Seeing how many clients are old and selecting the wrong file could be a disaster.
The files are not the issue here, the issue is the "page". The thing is, one user can easily have 20,000 pages. That's why I wanted a solution that can check the CurrentID of the page the user is on.
But agreed, the easiest solution would have been to have a File Upload button on the page, and have the user select the files, but the way the systems are setup, that'll never work. 
|
|
|
|
|
Hmm... Interesting problem.
Do I understand that there may be multiple devices dropping files into one common directory?
How will the program (or person) know which files to associate to a given page?
Is there a way of sending these "batches" of files to a unique folder? Do you have any way of performing a naming convention on the file names?
Something like ID001_crazyname1.pdf,ID001_crazyname2.pdf ...
Then everything with the prefix of ID001 could be uploaded to a particular page.
Just tossing some ideas out there ...![Java | [Coffee]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/coffee.gif)
|
|
|
|
|
Correct, there can be multiple devices dropping images into predefined folders (these devices are being controlled and setup by other companies, so we don't have much control over them).
A normal workflow would be:
1. A client creates a 'New Page' on our website. Supplies some details.
2. The client then starts the 3rd-party software and from there select "Transfer File(s)"
3. These files are saved in predefined folders, our small desktop application picks them up and sends them to a web service.
It's safe to assume that the files the client selected to transfer from the 3rd-party software should be attached to the current Page they created on our website.
Sadly enough, we can't in any way change the naming convention and in some cases not even the destination folder (a few of these devices create new sub folders after xxx number of Mb or random number of files).
The problem is to figure out what page they are on, and how to clear that PageID from the "CurrentPageId" when the client is no longer working on that page.
|
|
|
|
|
hi
I need
Programming Chat supports video and audio and the number of connected high
I have a Windows server I want a programmer who has an idea or a program ready
The program supports all browsers
It supports camera operation
It supports the microphone
It supports dozens of visitors simultaneously
An example of what I want
http://www.ksacam.info/ksacam/defaults.htm
|
|
|
|
|
This site is a place to ask free questions that are answered by volunteers. What you need to do is hire someone. Please google for an appropriate site.
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.
|
|
|
|
|
Hey, I', looking for some implementation advice. I am creating this ASP.NET MVC page for quizzes that each course may have a different number of questions with 4 choices. I would like to send the questions to my view as my Model, and by submitting the form, my controller endpoint receives the Id of the questions and selected answers.
Can you please give me some tips that how to send such information to my controller using the sample code I wrote in the following?
Thank you in advance.
My Model
public class QuizQuestion
{
[Key]
public int QuestionId { get; set; }
public int CourseId { get; set; }
public int Order { get; set; }
public string Question { get; set; }
public string Choice1 { get; set; }
public string Choice2 { get; set; }
public string Choice3 { get; set; }
public string Choice4 { get; set; }
public int RightAnswer { get; set; }
}
My View
using (Html.BeginForm("Submit", "Quiz", FormMethod.Post, new { }))
{
@Html.AntiForgeryToken()
foreach (var item in Model.QuizJustQuestionsDto)
{
<div class="row">
@(item.Order + ". " + item.Question)<br />
@Html.RadioButton(item.QuestionId.ToString(), 1) @Html.Label(item.Choice1)<br />
@Html.RadioButton(item.QuestionId.ToString(), 2) @Html.Label(item.Choice2)<br />
@Html.RadioButton(item.QuestionId.ToString(), 3) @Html.Label(item.Choice3)<br />
@Html.RadioButton(item.QuestionId.ToString(), 4) @Html.Label(item.Choice4)
</div>
}
|
|
|
|
|
|
Hello,
I want just the administrator can see the admin page.
How can I do this job with ASP.NET authentication and autherization in web.config page?
Saeed
|
|
|
|
|
Well, in order for that to work you need to apply RoleBased Authentication. After that you create a folder called "Admin" or similar, place a web.config in that folder:
<configuration>
<system.web>
<authorization>
<allow roles="Administrator"/>
<deny users="*"/>
</authorization>
</system.web>
</configuration>
This site explains what you need to do: Microsoft Role Based Authentication
All you have to do is to create a few roles like Administrator, User, Customer. Then add users to those roles. The web.config in each folder will ensure that only people with that specific role can get in.
|
|
|
|
|
Dear friends Iam new to Asp.net i want to deign one repeater template post based that show me data from databse data may be only text data may be image with text data may be vedio may be only image. so please guide me or give solution
thanks
|
|
|
|
|
I think you need to try a little bit harder yourself first, rather than asking for such general help. If you search online for "asp.net repeater examples" you will find plenty of help to get your started.
|
|
|
|
|
I searched Alot but no solution found that's why i am asking for help. Dear
|
|
|
|
|
Well, the best thing to do when stuck on any problem is to first try to solve a simpler one. SO I suggest you follow some of the simple examples you can find on the Internet to get a better understanding of how to use the repeater control. You should then be able to make a start on what you want to do, and can come back and ask with some specific problems if you still have any.
|
|
|
|
|
ok i will try it, but it would be better if i have found a solution here on this forum
THanks Dear
|
|
|
|
|
No - it might be easier to be given an answer, but better is to learn for yourself. Also, while it might be easier for you, it would be harder for others who volunteer their time to help on these forums.
|
|
|
|
|
yeah you ar right but this time it is harder for me
|
|
|
|
|
Having done as was suggested by G_Griffin ie: search ASP.Net Repeater control examples, and selecting videos as my filter I found an excellent lesson from an old friend "Kudvenkat" on Youtube here (https://www.youtube.com/watch?v=v3w0XWWyVO4). It may be after you watch the following video, you may decide to instead use a gridview control, but either way this is an excellent lesson for introducing the repeater control.
I learn best by watching video lessons and writing the code as a follow along method and I have learned most of my coding languages from kudvenkat and a few others.
|
|
|
|
|
I am struggling with trying to figure out how I can output a trace message in ASP.NET using the Trace.Write() method inside of a for loop in order for a user to see the future value after 1 month, 10 months, and 50 months? The format should be like this:
Month{i}: & Value{futureValue}. So, for example, the format should look like this after the first month: "Month:" {i} "Value:"{futureValue}. i know that's not right but that's why I need help understanding how I can input the variables correctly into this method. I have researched my problem, but it's not specific to my individual problem. Here is the site I have researched before coming here: (http://www.c-sharpcorner.com/UploadFile/225740/how-to-write-custom-tracing-message-in-Asp-Net/)
<pre lang="c#"><pre>namespace XEx05FutureValue
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
for (int i = 50; i <= 500; i += 50)
ddlMonthlyInvestment.Items.Add(i.ToString());
}
protected void btnCalculate_Click(object sender, EventArgs e)
{
if (IsValid)
{
int monthlyInvestment = Convert.ToInt32(ddlMonthlyInvestment.SelectedValue);
decimal yearlyInterestRate = Convert.ToDecimal(txtInterestRate.Text);
int years = Convert.ToInt32(txtYears.Text);
decimal futureValue = this.CalculateFutureValue(monthlyInvestment,
yearlyInterestRate, years);
lblFutureValue.Text = futureValue.ToString("c");
}
}
protected decimal CalculateFutureValue(int monthlyInvestment,
decimal yearlyInterestRate, int years)
{
int months = years * 12;
decimal monthlyInterestRate = yearlyInterestRate / 12 / 100;
decimal futureValue = 0;
for (int i = 0; i < months; i++)
{
futureValue = (futureValue + monthlyInvestment)
* (1 + monthlyInterestRate);
if (Trace.IsEnabled)
{
Trace.Write({i} {futureValue});
}
}
return futureValue;
}
protected void btnClear_Click(object sender, EventArgs e)
{
ddlMonthlyInvestment.SelectedIndex = 0;
txtInterestRate.Text = "";
txtYears.Text = "";
lblFutureValue.Text = "";
}
}
}
|
|
|
|
|
Dorakta wrote: ... in order for a user to see ...
Trace output is intended to help the developer when building the site. It should never be shown to the end user.
If you want to show something to the user, then you need to add it to the page somewhere.
Markup:
<dl>
<asp:placeholder id="futureValueList" runat="server" />
</dl> Code:
for (int i = 0; i < months; i++)
{
futureValue = (futureValue + monthlyInvestment) * (1 + monthlyInterestRate);
Trace.Write(string.Format("{0}: {1:C}", i, futureValue));
var dt = new HtmlGenericControl("dt");
dt.InnerText = string.Format("{0} months", i);
futureValueList.Controls.Add(dt);
var dd = new HtmlGenericControl("dd");
dd.InnerText = futureValue.ToString("C");
futureValueList.Controls.Add(dd);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I wrote a UPS Rate Quote Service in c# using the supplied WSDL file.
So now I'm testing it, at first the error in transmitting the SOAP file was "An exception has been raised as a result of client data." and the catch would catch it using Exception. Same thing with FaultException.
I read the stack trace, it refers to the Soap call to ProcessRate(Security, Request) in reference.cs and went to line 6492 and 6499.
I wrote another class as the bare minimum and transmitted again and got the same result.
I really don't know how to proceed here.
Soap Call
try
{
using (var client = new ups_rateService.RatePortTypeClient(new BasicHttpBinding(BasicHttpSecurityMode.Transport), new EndpointAddress(endpointUrl)))
{
pResult = client.ProcessRate(Security, pRequest);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}
Resources.cs
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
Indigo.Services.ups_rateService.RateResponse1 Indigo.Services.ups_rateService.RatePortType.ProcessRate(Indigo.Services.ups_rateService.RateRequest1 request) {
return base.Channel.ProcessRate(request);
}
public Indigo.Services.ups_rateService.RateResponse ProcessRate(Indigo.Services.ups_rateService.UPSSecurity UPSSecurity, Indigo.Services.ups_rateService.RateRequest RateRequest) {
Indigo.Services.ups_rateService.RateRequest1 inValue = new Indigo.Services.ups_rateService.RateRequest1();
inValue.UPSSecurity = UPSSecurity;
inValue.RateRequest = RateRequest;
Indigo.Services.ups_rateService.RateResponse1 retVal = ((Indigo.Services.ups_rateService.RatePortType)(this)).ProcessRate(inValue);
return retVal.RateResponse;
}
Stack Trace
System.ServiceModel.FaultException`1 occurred
HResult=0x80131501
Message=An exception has been raised as a result of client data.
Source=mscorlib
StackTrace:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Indigo.Services.ups_rateService.RatePortType.ProcessRate(RateRequest1 request)
at Indigo.Services.ups_rateService.RatePortTypeClient.Indigo.Services.ups_rateService.RatePortType.ProcessRate(RateRequest1 request) in J:\Indigo.Services\Service References\ups_rateService\Reference.cs:line 6492
at Indigo.Services.ups_rateService.RatePortTypeClient.ProcessRate(UPSSecurity UPSSecurity, RateRequest RateRequest) in J:\Indigo.Services\Service References\ups_rateService\Reference.cs:line 6499
at Indigo.Services.UPS_Soap_Rate.transmit_request(model_shipRates_rate_request p, RateRequest pRequest) in J:\Indigo.Services\Business Logic\Ship Processors\UPS\UPS_Soap_Rate.cs:line 203
If it ain't broke don't fix it
|
|
|
|
|
Well the documentation is dated Jun 2017 and the WSDL file is dated Dec 2007. So this WSDL was current as of VS2010.
Guess I'll toss it in the scrape pile and go back to XML or try the JSON version.
If it ain't broke don't fix it
|
|
|
|