|
I know that Websites successfully download executable files all the time. Any Website that sells its programs where you can download them right there on the spot does it. There's nothing special the user has to do to enter the Website. All they have to do to get the download is to go through the "Download File -- Security Warning" dialog.
Maybe there is no way around it if all your Website programming is in in the Silverlight app, which runs on the client. But Silverlight doesn't have to be the whole site. It can just be part of it. I have developed a commercial desktop program that I want to sell through the Web, and I have contracted a Website developer that is doing the bulk of the Website programming for me (since I'm out of my league there). He can't figure out how to download my installation program, which we've uploaded to the Website itself. He says he's "still working on it." I was just fishing around up here to see if anyone had any ideas.
Turns out I was probably asking the wrong question. Unfortunately, I still don't know what the right question is.
|
|
|
|
|
Well let's be clear, it's not the website that's downloading the file when you purchase a program over the net.
It's the user and his browser who is downloading the file. That's why the system allows you to save the file anywhere you want, because it's you doing it.
On the other hand, your Silverlight app is restricted in where it can save files because it's not under the direct control of the local user, and it could very well be malicious. ( Not that yours is malicious, just saying...)
Maybe there is a way you can have your app direct the browser itself to the URL from which it can download the file, and that would provide the functionality you seek.
|
|
|
|
|
This isn't a Silverlight problem. I have to put a regular HTML page behind our Silverlight Download button.
|
|
|
|
|
Maybe I'm looking at this the wrong way. Maybe the "File Download - Security Warning" dialog is coming directly from the Windows operating system because you're trying to write a file to the local machine from a Web browser. So maybe my question should be, how do I write to a file outside of Isolated Storage? Once I know how to get around the security issues that prevent that, the "File Download" dialog will be produced automatically. Please let me know. Am I on the right track? I just need some guidance here.
|
|
|
|
|
I can tell with some certainty that that dialog box is coming from the browser, as evidenced by the fact that Firefox has its own version of it which is different from IE's version.
As I said above, read about trust levels.
|
|
|
|
|
This is achieved by the use of Mime types and is very easy to do. Consider the following sample ASP.NET page
:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="~/googletoolbar2user.exe" runat="server">Exe</a>
</div>
</form>
</body>
</html> Clicking the link when it's running prompts the browser to display the warning you're after. Have a look at this post[^] to see more information on what you need configuring in IIS. There's no special voodoo, and I'm not surprised that books on ASP.NET don't teach this as it's more about general web development rather than Silverlight/ASP.NET issues."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
So in otherwords, behind our Silverlight Download button, we have to put a regular HTML page like your example. Now it's making a heck of a lot more sense. Shows how ignorant I am of this entire world of Web programming. Thanks a lot. It probably sounds incredibly basic to you, but all this is entirely new to me, so new that I don't even know how to pose the right questions.
|
|
|
|
|
Maybe im being silly but the simplest solution I can think of is to embed the silverlight in a HTML page which this javascript function:
function redirect(url){
window.location=url;
}
and then call that JS from silverlight with "http://domain.com/file.exe".Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
We've already got a fairly elaborate Silverlight app. So without refactoring the entire design, we have to work from Silverlight to HTML, not the other way around. I'm thinking of taking a rather crude approach: HtmlPage.PopupWindow, with the URI parameter to PopupWindow pointing at the HTML page that downloads the executable. If there's a more elegant solution someone could suggest (I'm sure there must be), I'd be grateful to receive it.
|
|
|
|
|
Well, you can set the URI straight to the exe to popup the download window. Therefore skipping the extra HTML page. Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
|
Hi,
I'm working in a silverlight aplication.
In the web project I built a domain service after create a ADO entity model. In the client project i can invoke the web project service methods.Everything is fine here.
But, now i add just a domain service(in the web project) and defined some methods here.The problem is when i try to access this methods in the cliente project. I can instantiate the service and invoke the method but it does not anyting. Do i have to give some special treatment when i call the service methods on the client project?
(Excuse my english but i do not speak it very weel )
thanks. regards jonatan
|
|
|
|
|
I'm developing a WPF Facebook application, and I was wondering whether there is any way that I can persist login information, so that users don't have to repeatedly type in their passwords everytime they want to view photos etc. Or lets say I have a bunch of passwords stored in a database, how can I log in to Facebook using that specific password without the user having to type it in?
I'm using the following to create a session:
session = new DesktopSession("[app key]", null, null, true,
new List<Enums.ExtendedPermissions>() { Enums.ExtendedPermissions.read_stream, Enums.ExtendedPermissions.publish_stream });
session.Login();
|
|
|
|
|
Hello everybody,
I have added a new xaml page in my silverlight project, but I don't know how to host it into a new aspx page rather, how do I do that? What I mean is I'm trying to have multiple silverlight(xaml) pages in one project and hosting them in different aspx pages.
Thank youmodified on Tuesday, February 23, 2010 7:55 AM
|
|
|
|
|
|
Hi there,
Hoping someone can help me with some issues I am having printing custom WPF controls. I have custom publishing application with a lot of WPF Custom Controls which host other Custom Controls - I would like to print these controls to XPS (or ideally PDF) so that they can be sent to a print house to be printed. The ideal format for me would be PDF, although in theory I should be able to convert XPS to PDF with the myriad of applications out there (currently I've used PDFCreator, Ghostscript, gDoc, PDFsharp, to name a few). I also use lots of render transforms and layout transforms to position visuals and control their size and orientation.
My main requirement is that the output file is a vector image and not a bitmap. Print media requires very high quality files, or the result looks awful!
The questions I'm hoping the smart members of the CodeProject can help me with are:
1. Has anyone done some preprocessing on a tree of Custom Controls and somehow converted them to more primitive WPF drawing components, like paths and formatted text? (This will help remove the dependency on the data).
2. Is there a way to create an XPS file well so that large amounts of image data are converted by PDFsharp (or similar) properly?
There are two approaches I've tried, each with its own set of problems:
1. Write the custom control as a Visual to an XPS fixed page document. Then convert to PDF using PDFsharp or PDFCreator.
2. Render the custom control to a high resolution bitmap, place the Image in a Canvas, create an XPS document, then convert to PDF. (My reason of not creating a PDF file directory, is that I would like to overlay other WPF controls on top of the bitmap, if possible). I'd like to avoid this.
The problems I've come across for each are:
1. Custom controls written to XPS file
a. Not all of the controls are rendered properly in the XPS viewer.
b. Strangely, if I print to PDF using PDF Creator from the XPS viewer, the controls that didn't display before get magically printed to the PDF file as bitmap images.
c. Bitmap images display in the XPS viewer, but don't convert to PDF (even though the image stream is inside the PDF file with bounding boxes!).
2. Render to high resolution bitmap
a. I lose the vector data, so I need to make sure the resolution of the output image matches the printing device and could result in odd edge and aliasing artifacts.
b. PDFsharp seems to think an Image in a Canvas is like a bitmap pattern. Why is it doing this? Any ideas on how to write a single image (without tiling) to a XPS file?
c. Writing the image directly to a PDF file is very easy, but this isn't what I want to do. I need to overlay the image with WPF Custom Controls.
Is there some way to open a RenderContext and then "render" the contents to a DrawingVisual?
Could this be a serialization issue in one of the classes my Custom Controls reference? I have vague recollections that these get obfuscated and stored inside the XPS file?
I'll be really indebted to anyone who could help. I'm really hoping there is a simple-ish way to do this. It could even by something like implementing some interfaces in my controls that allow WPF to traverse the nested Custom Controls, or to try to strip out all of the internal visuals. Or to make the WPF printing process use the Visuals inside my Custom Controls directly, rather than needing bound data. Or there is a way to do this using the framework and it's yet another wing of WPF to explore!
Many thanks
Mark
p.s. I have one final constraint: I can't buy any 3rd party components, so the "ultimate XPS to PDF converter" component that you may have would not be an option for me! For this project, I need to be cheap and write my own code.
|
|
|
|
|
How I get Application_Exit Eventhandler in javascript code....
I mean when Application_Exit Eventhandler fires how I notify in
javascript
modified 9-Jan-13 15:35pm.
|
|
|
|
|
Hi Kashif,
You can call any JavaScript function on your page like so:
void Application_Exit(object sender, EventArgs e)
{
HtmlPage.Window.Invoke("OnSilverlightExit", new[] { "some data" });
}
Here we see that the JavaScript function OnSilverlightExit is called and is passed a string parameter "some data".
The JavaScript function can then do whatever you need.
function OnSilverlightExit(identifier) {
}
There's some more information here[^] about communicating between a page in JavaScript with a Silverlight application.
Cheers,
Daniel
|
|
|
|
|
Hi everyone,
Problem is solved.
I find out the problem it is port number issue.
Thanks
I have been working on silverlight, it works fine for a while but becomes idle especially after one day or turn off my laptop.
By the way it correctly displays what I wished to view, it is a table from a .mdf database (AdventureWorksLT.mdf). Please help me it is urgent.
Thank youmodified on Monday, February 22, 2010 3:40 AM
|
|
|
|
|
Hi All,
I'm just making a Gallery viewer for my new site and am seeing something odd.
The Gallery page presents the user with a few galleries they can view, when they click a view button the gallery is opened in a ChildWindow . Everything works as expected until I close that window and click on another view button, the silverlight application bombs and I'm left with a blank browser. It might do it after clicking 4 galleries or just 1.
The app does better running under the development server rather than IIS (5.1). I'm listening for any UnhandledException but not seeing any. With no exception being throw this is pretty difficult to diagnose. Any ideas?
Thanks,
|
|
|
|
|
Hello,
I am having some issues with the display of the DataGridColumnHeadersPresenter in my custom DataGrid template.
Example Screenshots
I have taken the original ControlTemplate for DataGrid and altered the area related to the DataGridColumnHeadersPresenter and the select all Button. What I am experiencing when I load the application (Figure A) is the area taken up by the DataGridColumnHeadersPresenter is longer than it should be (on the right side) by 2 pixels (or whatever the margin is set to). It also appears clipped as it does not show the right side border or the corner radii.
When I adjust the size of the window at runtime using the Window 'resizing handles' (Figure B) the appearance changes and the DataGridColumnHeadersPresenter appears as I expect it to. However when I resize it small enough so that the DataGrid's horizontal scroll becomes active (Figure C) it again appears clipped, this time being a few pixels shorter than the expected length.
Custom Row, RowHeader, Cell and ColumnHeader styles are also in use, but removing them does not change this problem.
Original
<!--Left Column Header Corner -->
<Button Command="{x:Static dg:DataGrid.SelectAllCommand}"
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}}, Path=CellsPanelHorizontalOffset}"
Template="{StaticResource SelectAllButtonTemplate}"
Focusable="false"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
Path=HeadersVisibility,
Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
ConverterParameter={x:Static dg:DataGridHeadersVisibility.All}}" />
<!--Column Headers-->
<dgp:DataGridColumnHeadersPresenter Grid.Column="1"
Name="PART_ColumnHeadersPresenter"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
Path=HeadersVisibility,
Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
ConverterParameter={x:Static dg:DataGridHeadersVisibility.Column}}"/>
My Changes
<tkp:DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
Grid.Column="1">
<tkp:DataGridColumnHeadersPresenter.Template>
<ControlTemplate TargetType="{x:Type tkp:DataGridColumnHeadersPresenter}">
<Border Background="{Binding Path=AlternatingRowBackground,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
BorderBrush="#FFB4B4B4"
BorderThickness="0,1,1,1"
CornerRadius="0,2,2,0"
Margin="0,0,2,1">
<ItemsPresenter/>
</Border>
</ControlTemplate>
</tkp:DataGridColumnHeadersPresenter.Template>
</tkp:DataGridColumnHeadersPresenter>
<Border Background="{Binding Path=AlternatingRowBackground,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
BorderBrush="#FFB4B4B4"
BorderThickness="1"
CornerRadius="2,0,0,2"
Margin="0,0,0,1"
Width="{Binding Path=CellsPanelHorizontalOffset,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"/>
Any help or ideas on what might be causing this would be greatly appreciated.
-Michael
|
|
|
|
|
I have a application that is creating many dynamic window form controls and each has its event handlers. When I click on the cancel button I want all the dynamic controls to be disposed. My question is :
1. When the controls are disposed do the event handlers get removed to?
2. If the references to the event handlers are still there after disposing the control, how do i remove the event handlers associated with the dynamic controls. I have a dynamic controls like label, textboxes, checkboxes and combo boxes and each has its event handler. Is there way to unsubscribe all event handlers associated with a control without giving the name of the event handler?
This is sample code that i have written:
foreach (Control childControls in this.NodeIniPanel.Controls)
{
//childControls.Parent.Controls.Remove(childControls);
//this.NodeIniPanel.Controls.Remove(childControls);
if (childControls is TextBox)
{
childControls.Enter -= new EventHandler(tbxKeyValue_Enter);
childControls.Leave -= new EventHandler(tbxKeyValue_Leave);
childControls.KeyDown -= new KeyEventHandler(tbxKeyValue_KeyDown);
}
if (childControls is Label)
{
childControls.Click -= new EventHandler(lblSectionName_Click);
childControls.Click -= new EventHandler(lblSectionKeyName_Click);
childControls.MouseEnter -= new EventHandler(lblSectionName_MouseEnter);
childControls.MouseEnter -= new EventHandler(lblKeyName_MouseEnter);
}
childControls.Dispose();
}
|
|
|
|
|
Hi,
In WinForms there is no need to remove the event handlers at all; they are lists of delegates, and they reside inside the Control, so removing and disposing of the Controls takes care of everything.
Although I haven't looked at WPF in any detail, I see no reason why it would be different there. So IMO you can remove all those -= statements.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
how do I create a text locked, like when I choose a contact in hotmail and this adds to "to" and comes with an x and a pencil, I'm dragging text from a listbox to a richtextbox (WPF) but I want it to have the same style text locked in "to" that adds contacts to send an email in hotmail.
I hope I have understood, thank you very much for your reply
|
|
|
|
|
Hi,
I have a infragistics grid within a WPF user control and I want to expose the mouse double clicked event of the grid. I have multiple instances of this user control on a window
I had two options
1)Grid.MouseDoubleClick += xamDataGrid_MouseDoubleClicked; This worked as expected
2) xamDataGrid1.AddHandler(
DataRecordPresenter.MouseDoubleClickEvent, new MouseButtonEventHandler(GridRowDoubleClick_MouseClick), true);
When I used this, the Grid double clicked event was fired more than once at random for a single double click on the grid.
Pls suggest what could have caused this to fire this event multiple times.
Should I use the removehandler method to unwire the event in my usercontrol unload event.
Pls. advise.
Also suggest, which way is the right way to expose the mouse double click event of the grid.
Thanks,
Suha
|
|
|
|
|