|
ChrisB,
You mentioned you were interested in knowing the solution to my problem so here it is:
It actually turns out that although IE accepts this filepath as valid, it's not a good approach to take. So as a different approach, the key is to create a new webpage with the content type set to "application/octet-stream"
-I have a link on my initial page that reads "Click to download file".
-Link to a new aspx webform(I named mine "Download.aspx") & place the url to the downloadable file within either the URL or a session object (mine is within a session).
-Add this code to "Downloader.aspx":
-------------------------------------------
using System.IO;
protected void Page_Load(object sender, EventArgs e)
{
String filepath = Convert.ToString(Session["fileUrl"]);
String filename = Path.GetFileName(filepath);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.Flush();
Response.WriteFile(filepath);
}
------------------------------------------------
That solved my problem.
-Goalie35
|
|
|
|
|
Goalie35 wrote: the key is to create a new webpage with the content type set to "application/octet-stream"
Of course ! The same method as retrieving an image from a database (like a loadImage.aspx?id=123 page) - replace the page content with the content you actually want to supply.
Thanks for that.
ChrisB
|
|
|
|
|
I've googled etc... but can't find anything relevant.
I have a user control in a master page.
The user control access a session variable which may or may not exist.
If it doesn't exist, the user control doesn't display any content. If it does exist, it displays content.
The problem is that when a page creates the session variable in the postback, the user control is already created and at the time the user control code ran, the session variable didn't exist. This means that although the session variable exists, the user control is not displayed until the user navigates to the next page.
Is there any way to force a user control (which is in the master page) to load after the page code has run?
Thanks
ChrisB
|
|
|
|
|
You can have a method in your usercontrol to reread value of session variable. You can call this method in your code after you write value to a session.
Or you can override Render (or OnPreRender) method of your user control to reread session variable.
These methods are called after postback handlers, so your variable stored in session should already has desired value.
I like this solution more.
class MyControl : UserControl
{
...
...
...
protected override OnPreRender(EventArgs e)
{
// read value from session
SetContent(Page.Session["MY_SESSION_VARIABLE"].ToString());
base.OnPreRender(e)
}
}
Pilo
|
|
|
|
|
|
i use .NET 1.1
im my web site i have a HtmlInputFile
when i upload a small file that's ok
but when i want to upload big files it isn't work
and display "The page cannot be found"
how can i solve it ?
With thanks
MHF
|
|
|
|
|
It sounds like your browser is timing out before the upload has time to finish. You could try displaying an "uploading" page whilst the upload happens, though without your code it is diificult to say exactly what is going on
|
|
|
|
|
is there any where that limit the size of file ?
i use i use
HtmlInputFile.PostedFile.Write Method
MHF
|
|
|
|
|
yes there is a limit on the size of the file, it can however be changed see -
here
|
|
|
|
|
Thanks It is so Useful
MHF
|
|
|
|
|
There are three textboxex. I have given values in textbox1 and textbox2 as 10 and 20. if I hit the enter key not tab control the sum of two textboxes(30) will be displayed in textbox3. How can I write on client side using javascript? if anyone send code its nice.
thanks,
Hosanna.
|
|
|
|
|
You can use var elem = document.getElementById(id) to retrieve your text box element, then use elem.value = "whatever" to set its value.
See if you can figure out how to trigger the code. (Hint: you're probably wanting to investigate keyboard events for the text box element)
|
|
|
|
|
In my database contain path to image.Ther r N number of images.
I need to dynamically creat Image box and load image to it.
is there any way???
All I ever wanted is what others have....
CrazySanker
|
|
|
|
|
foreach(string imagePath in arrayOfMyImagePaths)
{
Image image = new Image();
image.ImageUrl = imagePath;
myPlaceholder.Controls.Add(image);
}
<asp:Placeholder id="myPlaceholder" runat="server"/>
... and so on.
Pilo
|
|
|
|
|
For each site, it should display the name of all the web parts contained in that site.mine is a asp.net application with c# as codebehind and developed in .net 1.1
thanks.
|
|
|
|
|
Hi,
I am want to create an Ajax page, can any one suggest me what are the requirments need to develope an Ajax site with ASP.NET with VB.NET.
Know is Drop, Unknown is Ocean
|
|
|
|
|
Hi,
You can download Ajaxpro DLL .. or you can use HTTPRequest object directly to use AJAX
Thanks,
Sushant Duggal.
|
|
|
|
|
http://en.wikipedia.org/wiki/AJAX">http://en.wikipedia.org/wiki/AJAX
http://www.adaptivepath.com/publications/essays/archives/000385.php
Aashutosh kumar
|
|
|
|
|
I am using MSACESS 2003.In my web developement i need auto increment number after insertion.Like SCOPE_IDENTITY in MSSQL.
if use select @@IDENTITY from <tblname> in MSACESS it returns 0.
send me any soln.
No pblm in incrementing.I need the increment value just after insertion
-- modified at 7:46 Thursday 5th October, 2006
All I ever wanted is what others have....
CrazySanker
|
|
|
|
|
did u seed and increment it.Then u will get the value with auto incremnt .
seed as 1 and increemnt as 1 then u will get auto increment.
With Regards
Satips
|
|
|
|
|
the problm is not in incremnting.I need the incremented value just after insertion.
All I ever wanted is what others have....
CrazySanker
|
|
|
|
|
You have to get the id using the same connection that you used to add the record.
---
b { font-weight: normal; }
|
|
|
|
|
If you want retrieve @@IDENTITY in MS Access you can use this function after inserting record in database : "Select Max(FieldName) From tableName"
|
|
|
|
|
Hello All,
I am working on ASP.NET 1.1. I am using a Panel control to add some controls at the runtime. Now the problem is that when the page displays, the panel moves to the bottom of the page. I have the panel in a table, but it moves out of that table and goes to the bottom. I am screwed up by this issue. Any help is very much appreciated.
thanks,
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Hi Mubashir.
It's an HTML issue. Can you please post your HTML code?
Thanks.
-Goalie35
|
|
|
|