Log into FogBugz through c# application - c#

I am trying to login into fogbugz using my c# application.I am using FogBugz XML API.
The code that I am currently using is:
<form method="post" action="https://xxxxx.fogbugz.com/api.asp?cmd=logon">
Email:
<input type="text" value="email" name="email">
<br />
Password:
<input type="password" value="password" name="password">
<br />
<input type="submit">
<br />
</form>
When I do this I do get logged into FogBugz.I get an XML file as output where I have my token under tags.
Is there any way to make the user see an aspx file and not the XML file but I could use the XML file and cache the token value?
I am new to FogBugz please help!
Thank you.

I would recommend checking out FogLampz.
It allows you to write code such as:
FogBugzClient.LogOn("https://myproject.fogbugz.com/api.asp",
"email#mydomain.com", "password");
var projects = FogBugzClient.GetProjects();
var areas = FogBugzClient.GetAreas();
Use this in your code-behind for your aspx page. (you wont need your form action pointing to fogbugz)
You can then display/modify/do-anything-to the results as you wish.
Alternatively there is the Fogbugz Csharp API Wrapper which allows very similar coding style to pull out FogBugz data.

Related

Is it possible to give name to Quasar Uploader in <form>

I have a <form> where I am using Vue.js and Quasar, and submits in as a HTML form in asp .net core 3.1
The problem is when I am using Quasar Uploader (https://quasar.dev/vue-components/uploader).
The functionality works fine, but when I submit the form (post i C# and .net core).
I cant get the the file in the controller.
As you can see from this example: https://codepen.io/cbrown___/pen/GRZwpxw
When the Uploader is rendered it does not have the attribute name. From the example above you have this input:
<input tabindex="-1" type="file" title="" class="q-uploader__input overflow-hidden absolute-full">.
I guess that is why I cant get it from my Controller. How can I solve this when I am using .net Core 3.1 to submit this form?
And I see no good solutinos in letting people upload files through my API before the record is created.
Is it a option here I do not see?
EDIT:
The <input> is on the plus-icon. So by using inspect elements you should be able to see that no name occurs.
EXAMPLE CODE:
HTML
<div id="q-app">
<div class="q-pa-md">
<div class="q-gutter-sm row items-start">
<q-uploader
url="http://localhost:4444/upload"
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
color="teal"
flat
bordered
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
label="Upload files"
color="purple"
square
flat
bordered
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
label="No thumbnails"
color="amber"
text-color="black"
no-thumbnails
style="max-width: 300px"
></q-uploader>
</div>
</div>
</div>
JS:
new Vue({
el: '#q-app'
})
If any body else need this I ended up with using this:
:name="'file_description[' + index + ']'"
That way each one got one name...and from another array I knew how many file_description it would be.

How to update ng-change/ ng-model using C# code?

I am using MSHTML to automate oen workflow involved Angular. I am able to add the value in text box but somehow underline function doesn't get call and hence I get unwanted result.
below is the sample:
objIHTMLElement = doc.getElementById("email");
objIHTMLElement.setAttribute("value", "sas#abc.com");
html looks as below:
<div class="inpt-fld-err-msg-inline">
<input title="Email Add"
class="ng-valid ng-valid-maxlength ng-touched ng-dirty ng-empty"
id="email" aria-invalid="false" type="text" maxlength="50"
ng-change="save(SearchParams)"
ng-model="SearchParams.userProfil" autocomplete="off">
</div>
is there any way to do it using C#?
Regards,
Ajit
You can register and call you javascript method by passing appropriate parameters via following syntax from C#:
Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","save(" + SearchParams + )",true);
Kindly refer to this post: Calling JavaScript Function From CodeBehind

asp:TextBox add data attribute data-emojiable="true"

I want add smiles to my asp:TextBox. I find project at Git Hub [https://github.com/one-signal/emoji-picker][1]
But in an example they used html tag - input, but I need to use asp:TextBox. And when I add all as on this site, it does not work.
Here they works example
<p class="lead emoji-picker-container">
<input data-emojiable="true">
</p>
And here my example that doesn't work
<p class="lead emoji-picker-container">
<asp:TextBox ID="txtSubject" runat="server" data-emojiable="true" ></asp:TextBox>
</p>
You can do following on server side code to add attribute.Check for css and js files as well.
txtSubject.Attributes.Add("data-emojiable","true");

Form post method complete coding

Following is the HTML form code, for uploading text value and a JPEG file.
<html>
<head></head>
<body>
<form action="https://mywebsiteforexample.com/" method="post" enctype="multipart/form-data">
<input type="text" name="id" value="01"/>
<input type="file" name="image">
<input type="submit" value="send">
</form>
</body>
</html>
Problem is whenever I have to upload the file on server, I need to manually browse the file to upload it. I want to write the same code in C# so when I run the code it itself select the file by path given, and upload the file so I don't need to browse and select the file manually. Is it possible.
You don't need to write code that fills input elements (if you want, use Selenium with C# driver). Just simulate POST action from simple console application using for e.g. HttpClient.
There are plenty of questions on SO how to do it, e.g. C# HttpClient 4.5 multipart/form-data upload

ASP.NET - Using SagePay Form Method Within a Content Page

I have an ASP.NET site and need to post some hidden form fields to SagePay so that my customers can pay for goods. I am using the following method to do this:
<input type="hidden" name="VPSProtocol" value="2.23" />
<input type="hidden" name="Currency" value="gbp" />
<input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="myvendorname" />
<input type="hidden" runat="server" id="crypt" name="Crypt" value="#<encrypted string>" />
<asp:Button ID="Button1" runat="server" Text="Pay Now" PostBackUrl="https://live.sagepay.com/gateway/service/vspform-register.vsp"/>
Now, If I use this code in a standard ASP.NET form, this works fine - SagePay accepts the posted information and continues with the payment process. However, if I use the same code inside a content page with a master page, Sagepay displays the following error screen:
5030 : We could not process your message, please check your
integration settings or contact the support team.
It seems as if the hidden fields are losing their value because of the master page.
Could anyone tell me what could be happening here and if there is anything I can do to rectify the situation. I need to use the SagePay Form method and I need to use a masterpage.
I haven't used webforms for a while but from memory by default it changes the names of your elements based on their container to allow navigation and identification server side: MSDN documentation here.
This means that your posted values are not under the name you expect them to be.

Categories

Resources