|
Hi all,
I have this piece of code which sends the pdf to printer, using AcroRd32.exe to achieve this.
for (int i = 2; i <= 3; i++)
string filename = @"\c:\myfile" + i + ".pdf";
string parameters = String.Format(@"/t ""{0}"" ""{1}""", filename, printername);
ProcessStartInfo processStartInfo = new ProcessStartInfo(pdfpath, parameters);
Process process = Process.Start(processStartInfo);
process.WaitForInputIdle(80 * 1000);
process.Kill();
}
I want to print multipe pdfs for this. I put this logic in a for loop. For some reason it does not print the second document. Does the kill completely kill the entire process?
|
|
|
|
|
There is no open brace character "{" after your for statement.
|
|
|
|
|
Hey friends,
I am having a minor problem regarding the use of javascript function in my asp.net page.
Whts the cause of malfunctioning?
The code is as follows:
<script type="text/javascript">
function ask() {
return confirm('Do u really want to delete?');
}
</script>
<asp:Button ID="btnDeletewithoutfn" OnClientClick="javascript:return confirm('Do u really want to delete?');" Text="Delete" CommandName="Delete" runat="server" />
<asp:Button ID="btnDeletewithfn" OnClientClick="ask()" Text="Delete" CommandName="Delete" runat="server" />
The button
btnDeletewithoutfn works as intended i.e. page posts back if user clicks Ok otherwise not.
But the button
btnDeletewithfn always posts back regardless the user clicks Ok or Cancel.
Any guidance about the problem presented.
|
|
|
|
|
that's because you aren't returning the value of the response from your call to the ask() function.
try the following:
<asp:Button ID="btnDeletewithfn" OnClientClick="return ask();" Text="Delete" CommandName="Delete" runat="server" />
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Thanks, Dennis and Alok
|
|
|
|
|
In an attempt to do human detection for a support web page, I've come up with a scheme I think might be viable, and I wanted to run it past you guys.
The idea is to present a table with a randomly selected number of columns (from three to five), with two rows. the first row contains images, and the second row contains Submit buttons.
The images that can be presented (at least 20, probably more) are contains in a folder with descriptive names, such as "green square", "dog", or "car". When a user goes to the page, the files are randomly selected, and for each file, a file name based on a quid is created, and the original file is copied to a temp folder with the guid file name. One of the selected files is randomly selected as the "correct" image, and the user is prompted to click the appropriate button (based on its original file name, like this:
"Click the submit button under the picture of XXXXX"
where "XXXXX" is the name of the original file (minus the extension, of course). So, if one of the displayed files was "dog 01.jpg", a guid file name would be generated like this - "00000000-0000-0000-00000000.jpg" - and the control's ImageUrl is set to this guid file name, and the prompt would read "Click the Submit button under the picture of the dog."
This mechanism is intended to prevent bots from learning the system by looking at the image name, or expecting a fixed number of choices, and still allows a number of "dog" images to be used so that the image isn't the same every time the page is presented. Post-backs would delete the temporary images.
What do you guys think? Will it be effective?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
The biggest problem is the small number of choices. The bot could choose choice #1 a thousand times and be right often enough to keep spamming.
Captchas make it so that the bot can try a thousand times and still be wrong a thousand times. Captchas aren't perfect, but I don't know anything better.
|
|
|
|
|
But the choices (and number of choices) changes every time the page is refreshed.
That means every attempt could still be wrong.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
If the page has 3, 4, or 5 submit buttons per page, and a completely random submit button is the correct one each time, then choosing the first submit button you see will be correct about 25% of the time.
Assume your website creates user accounts and a spam bot wants to create spam user accounts. The spam bot could be programmed to choose the first submit button every time and to simply ignore all text and pictures. In the end, 75% of the time, the web page will reject the user account, and 25% of the time, the spam bot will successfully create a spam user account. If the spam bot tries 1000 times, it will create about 250 spam user accounts.
I assume the final result of 250 successfully-created spam accounts per 1000 spam attempts is not desirable.
|
|
|
|
|
This is just for send an email, not creating accounts.
BTW, it's widely known that most/all captcha systems have been broken - that's why I'm not considering their use.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Captcha systems aren't perfect, but it takes really advanced algorithms to break them. The system you proposed could be broken with simple algorithms that don't require image analysis.
I think your best defense is a good spam filter for your email address; if it's posted on a public website, it will get picked up by spammers, and most IT departments already have high quality spam filters, as the vast majority of email they get is spam.
If you're adding the additional protection of making it hard for spammers to automatically scrape the email address from the website, any simple submit before displaying the email address should do, as the spammers won't be targeting your website specifically.
|
|
|
|
|
The email address itself isn't presented anywhere. The user has to send email through the web site.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I know that Membership uses it's own database. But can we use direct Membership to use our own tables and perform the same functions.
|
|
|
|
|
Yes Membership provider uses it's own predefined tables. But if you wnt to use your own custom tables then you need to write your custom membership provider. Lots of tutorials available for this. You can find it easily.
|
|
|
|
|
yes ,u can do this by providing your set of logic to validate the user.
|
|
|
|
|
I have a C# asp.net 2010 web page where would like to see how to setup code for the following:
I would like users to enter an organiztion name in a textbox. I would then like to take the organization name that is in the textbox and tie it to a checkboxlist control. The checkbox list control will contain all the suborganizations associated with the main organization. (For your information the cehckbox list control will be used by the users for other selections.)
I am asking for this code since the smart code that I use in the designer is not giving me a selection the textbox control as an option for me to tie the code together.
|
|
|
|
|
Why don't you write custom code for this.
|
|
|
|
|
What kind of custom code would I write for this? You you tell me and/or give me urls (links) that I can use as a reference? This is my first web form project that I am working with.
|
|
|
|
|
I am having the following problems with a C# asp.net 2010 checkboxlist control that I drag from the toolbox onto the designer or source view.
1. When I drag the checkbox list control to be embedded within an asp.net table in either the desginer or source view, I do not see all all the options for the smart tag like to connect to the datasource.
2. When I drag the checkbox list into the designer or source view and outside of a web table control, I do see the data source control. However, I have the following problems:
a. The wizard does not see the linq controls that are in the master page.Do you know of a way for the wizard to see the datasource in the master page? If so, how do you accomplish this task?
b.Thus I create a new datasource and select the appropriate datacontext object. However when I want to connect the checkbox list object with a textbox for a where statement, there is not an option to find the textbox I am looking for. The only selection option is the checkbox list itself. The textbox I want to obtain the value from is embedded within the asp.net table.
Thus basically can you make a suggestion how the checkbox list control can obtain the value in the textbox? Is the problem due to embedding the controls in an asp.net table?
The folllowing is the code I am referring to:
^<asp:Content ID="Content4" ContentPlaceHolderID="ReportForm" runat="server">
<ajx:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true">
</ajx:ToolkitScriptManager>
<asp:UpdatePanel ID="AttUploadUpdatePanel" runat="server">
<ContentTemplate>
<table style="width: 100%;">
<tr>
<td>
<table style="width: 50%;">
<tr>
<td width="100px" rowspan="5">
</td>
</tr>
</table>
</td>
<asp:Table ID="uploadAttb" runat="server" Height="35px" HorizontalAlign="Center"
Width="50%">
<asp:TableRow ID="trTitle" runat="server" HorizontalAlign="Center">
<asp:TableCell runat="server" RowSpan="2" ColumnSpan="4" VerticalAlign="Top" HorizontalAlign="Center">
<div>
<asp:RangeValidator ID="RangeValidator2" runat="server" Type="Date" CssClass="errorStyle"
ControlToValidate="txtReceiveDate" ErrorMessage="Receive Date must be in mm/dd/yyyy format and be a valid Date"
MaximumValue="12/31/2100" MinimumValue="01/01/1990" Display="Dynamic"></asp:RangeValidator>
</div>
<asp:Label ID="Label1" runat="server" CssClass="RptPageTitle" Text="Att View" />
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server" ColumnSpan="2">
<asp:TableCell runat="server">
<asp:Label ID="lblResultMsg" runat="server" CssClass="msgStyle" />
<asp:Label ID="lblErrorMsg" runat="server" CssClass="errorStyle" />
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server" HorizontalAlign="Right">
<asp:Label ID="Lable2" runat="server" Text="Organization Name" CssClass="RptFormLabel" />
</asp:TableCell><asp:TableCell runat="server" HorizontalAlign="Left">
<asp:TextBox ID="txtOrgID" Visible="false" Enabled="true" runat="server" Width="100"
MaxLength="10" />
<asp:TextBox ID="txtOrgName" runat="server" Width="250" CssClass="TextBoxStyle" OnTextChanged="FindOrg"
AutoPostBack="true" MaxLength="100" />
<ajx:AutoCompleteExtender ID="AutoCompleteAtt" runat="server" CompletionListCssClass="AjaxListStyle"
TargetControlID="txtOrgName" ServiceMethod="GetList" ServicePath="Att.aspx"
MinimumPrefixLength="1" CompletionInterval="200" CompletionSetCount="10">
</ajx:AutoCompleteExtender>
</asp:TableCell></asp:TableRow>
<asp:TableRow runat="server" Visible="true">
<asp:TableCell ID="TableCell4" runat="server" HorizontalAlign="Right">
<asp:CheckBoxList ID="CheckBoxList2" runat="server">
</asp:CheckBoxList>
</asp:TableCell></asp:TableRow>
<asp:TableRow ID="TableAttReceiveDate" runat="server" Visible="true">
<asp:TableCell ID="TableCell1" runat="server" HorizontalAlign="Right">
<asp:Label ID="Label3" runat="server" Text="Received Date" CssClass="RptFormLabel" />
</asp:TableCell><asp:TableCell ID="CellReceiveDate" runat="server" HorizontalAlign="Left">
<asp:TextBox ID="txtReceiveDate" CssClass="TextBoxStyle" Enabled="true" runat="server"
Width="150" MaxLength="100" AutoPostBack="true" />
<ajx:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" TargetControlID="txtReceiveDate">
</ajx:CalendarExtender>
</asp:TableCell></asp:TableRow>
<asp:TableRow ID="TableRowDisrpt" runat="server" Visible="true">
<asp:TableCell ID="TableCellDirRpt" runat="server" HorizontalAlign="Right">
<asp:Label ID="Label4" runat="server" Text="Reports Provided " CssClass="RptFormLabel" />
</asp:TableCell><asp:TableCell ID="TableCell2" runat="server" HorizontalAlign="Left">
<asp:DropDownList ID="ddlDisRpt" runat="server" CssClass="TextBoxStyle" Width="155">
<asp:ListItem Text="NO" Value="N" Selected="True" />
<asp:ListItem Text="YES" Value="Y" />
</asp:DropDownList>
</asp:TableCell></asp:TableRow>
</asp:Table>
</td></table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>^
|
|
|
|
|
Hello All,
I need to open atleast 8 pdfs, in one HTML page. I can use the embed tag,
<embed src="http://test1.pdf" width="500" height="500" /> to open one pdf.
Is there a way, I can open more pdfs in this one html page? Also, I am getting the names of the pdfs from database, so pretty much to have <embed /> tag on the server side page, c# code.
<embed src="http://test<variable>.pdf" width="500" height="500"></embed>
|
|
|
|
|
though I answered a question like this yesterday but I can't find it anywhere...
your best bet is probably going to be through the use of iframe . I think I even mentioned using them in a gridview that you populate programmaticaly. I would also recommend using a lightbox or a jQuery dialog unless you want them open all at the same time.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Dennis E White wrote: though I answered a question like this yesterday but I can't find it anywhere...
That's easy: go to your member page, there click "Messages", and you will see it after a short search.
|
|
|
|
|
Hello All,
I want to open PDF file in new window on button click event from code behind through JavaSctipt.
I am using below mentioned code for opening PDF file in new window.
string PopUpWindowPage = @"E:\\\Prism4.pdf";
string Script = "";
Script += "<script id='PopupWindow'>";
Script += "confirmWin = window.open(' " + PopUpWindowPage + "','" + 1 + "','scrollbars=yes,resizable=1, width=960,height=500,left=50,top=130,status');";
Script += "</script>";
if (!Page.IsClientScriptBlockRegistered("PopupWindow"))
Page.RegisterClientScriptBlock("PopupWindow", Script);
I get below mentioned error message while opening the PDF file in new window.
Microsoft JScript runtime error: Access is denied.
Can Anyone tell me whats the issue with above code or any other settings have to do?
Thanks in Adv...
|
|
|
|
|
1) Check the file path is correct and accessible using normal window.open() method
2) try not using depricated method.
There are general reasons for this error
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
|
|
|
|
|
You need a client script manager first. cs = clientscript manager
Dim cs As ClientScriptManager = Me.Page.ClientScript
Dim rsType As Type = Me.GetType()
If (Not cs.IsClientScriptIncludeRegistered(rsType, "jquery")) Then
cs.RegisterClientScriptInclude("jquery", cs.GetWebResourceUrl(rsType, "SC_Standard.jquery.js"))
End If
|
|
|
|