|
Turn the
<br />
customErrors mode = "On" defaultRedirect="YouErrorPage.aspx"<br />
<br />
/customErrors<br />
<br />
it appeared ok in the preview. Some wierd html thing made the tags invisible.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
i need source code to play audio files using asp.net 1.1/c#
danny
|
|
|
|
|
try this
using System.Runtime.InteropServices;<br />
<br />
public class Sound<br />
{<br />
[DllImport("winmm.dll")]<br />
protected static extern bool PlaySound(string lpszName, int hModule, int dwFlags);<br />
protected const int SND_FILENAME = 0x20000;<br />
protected const int SND_ASYNC = 0x1;<br />
<br />
public static void Play(string audioFullpath, int minSeconds)<br />
{<br />
DateTime now = DateTime.Now; <br />
TimeSpan ts = now.Subtract(lastPlayed);<br />
if (ts.TotalSeconds > minSeconds)<br />
{<br />
PlaySound(audioFullpath, 0, SND_ASYNC | SND_FILENAME);<br />
lastPlayed = now; <br />
}<br />
}<br />
}<br />
<br />
Sound.Play(@"c:\sample1.wav",30);
regards
GV Ramana
|
|
|
|
|
I have to provide download of files in ASP.NET 2.0
I am using following lines of code.
try
{
Byte [] bytes = this.ContentController.GetFileContents(filePath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=File" + _fileExtension);
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Buffer = true;
Response.BinaryWrite(bytes);
Response.Flush();
}
catch(FileNotFoundException fnfe)
{
this.ShowErrorMessage(this.GetErrorString(ResourceIdentifiers.DOCUMENT_FILE_NOT_FOUND_ERROR));
}
catch(Exception ex)
{
this.ShowErrorMessage(this.GetErrorString(ResourceIdentifiers.DOCUMENT_UNEXPECTED_ERROR));
}
Using above code, when one clicks on file link, a default download box of IE appears. If user clicks on Save, the file gets saved on disk and user can open that file. If user clicks on Open, it opens registered application with file type and says, file not found. Using same code I am able to open Word file but I cannot open Excel, PDF files.
Note: My application used Master pages, UIP Application Blocks. The code written above is inside a user control which gets loaded on view (webform) dynamically based on configration(xml) file.
Please can anyone suggest what could be going wrong in the piece of code because of which I am not able to open Excel/PDF files.
Apprciate your help.
Thanks and regards,
Ashish
|
|
|
|
|
Response.ContentType = "application/vnd.ms-excel"
Response.ContentType = "application/pdf"
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
ToddHileHoffer, thanks for your help.
I am still the same problem. Could anything else you can think of to getrid of this problem
- ashish
|
|
|
|
|
VB.NEt code that works from my old application.
' The following code writes the pdf file to the Client’s browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname) 'String location of the file
Response.Flush()
Response.Close()
'delete the exported file from disk
System.IO.File.Delete(Fname)
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Seems I get the problem when I use UIPAB. Otherwise the same code works fine.
Any idea what UIPAB does different.
- ashish
|
|
|
|
|
Hi,
I want to make http request for html page of other site in .aspx page of my site. This html page contain frames. I am using webrequest object to request this html page. When I checked the output string of Request.GetResponse.GetResponseStream it contain the html code of the page i.e etc. and not the actual output. Due to this, .aspx page display complete blank output. The code written to call this frame page is as follows.
Request = WebRequest.Create(URL)
'Request.Timeout = 10000
'Request.ContentLength = body.lenth
Request.ContentType = "application/x-www-form-urlencoded"
Request.Method = "POST"
'Request.AllowAutoRedirect = True
ItemStream = Request.GetResponse.GetResponseStream
Dim tr As StreamReader = New StreamReader(ItemStream)
_Result = tr.ReadToEnd
Note : URL is the html page which contain frame and reside on some other server.
Kindly let me know how to request frame page using webrequest object or any other method.
Regards
Nilesh
|
|
|
|
|
If you want the contents of the frames, you have to parse the page that you got to get the URL:s for the frames, so that you can request them from the server.
---
b { font-weight: normal; }
|
|
|
|
|
A project in .NET 2.0 C#. I have used the calendar to let user select the start date. However I do not know how to calculate the end date if the duration is 3 months after clicking the submit button. The end date will be displayed at the lblEndDate.
<br />
public DateTime strEnd; <br />
protected void Calendar1_SelectionChanged(object sender, EventArgs e)<br />
{<br />
txtStartDate.Text = Calendar1.SelectedDate.ToString("dd MMM yyyy");<br />
}<br />
protected void btnStart_Click(object sender, EventArgs e)<br />
{<br />
}<br />
thanks in advance. Much appreciated.
|
|
|
|
|
Inspite of using adddays you can use addmonths which requires no. of monts as a parameter.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks you ring something to me. I still insist on using days. And it can work. Thanks Apurva Kaushal.
lblEndDate.Text = Calendar1.SelectedDate.AddDays(81).ToString("dd MMM yyyy"); // subtract 3 days because I want to end on a friday
Loving Code Project
|
|
|
|
|
if you requirement is not fixed to the number of months(an integer) then your choice is obvious of AddDays.
Best Regards,
Apurva Kaushal
|
|
|
|
|
lblEndDate.Text = Calendar1.SelectedDate.AddMonths(3).ToString("dd MMM yyyy");
Nav.
|
|
|
|
|
Oh my. I suddenly have the solution before you submit the answer.
Thanks Nav for your effort replying.
lblEndDate.Text = Calendar1.SelectedDate.AddDays(81).ToString("dd MMM yyyy"); // subtract mondays,sundays,saturdays
Thanks NAV!!!!!!!!!!!
|
|
|
|
|
Hi all!
Please help! how can I include an aspx file within an aspx file.
I tried using
but there are errors. It is because of this line in second aspx file.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="m_customer.aspx.vb" Inherits="Exe_M_Customer" MasterPageFile="~/Exe/Template.master" %>
i tried to delete this line, and it worked. but when the codes are compiled errors occured.
pls help.
using master pages doesn't seem to help because its concept is the other way around.
i need to do this to shorten the aspx content
for example, I have a multiview control, then I want to put the controls for each view in a separate file for easy maintenance.
That's all. Thanks.
I hope you can help me on this.
|
|
|
|
|
Hi there,
IMO, you just use the user control instead (ascx file)...
<< >>
|
|
|
|
|
doyang wrote: using master pages doesn't seem to help because its concept is the other way around.
Master page provides a common layout to your site by INCLUDING other pages in content areas of the master page. How is this "the other way around"?
only two letters away from being an asset
|
|
|
|
|
Hey people, Could somebody sujest a way to export a set of web pages to excel - a page a sheet. For single page exports i use the ContentType specifications. But im not able to export multiple pages. All pages come into a single sheet.
I tried using Excel object, but as far as i could explore, it lets me to enter values to each cell which is almost impossible to do for a web page which contains data spread across many tables and tds (Un Structured). Moreover it consumes lots of time for execution.
I also tried using OWCs 9.0 and 11.0, but msdn advises not to use it also it demands licensed office versions in client systems, that i cant guarantee.
At last i tried to generate an XML document from the Response (HTML) string, to a XL schema valid xml. But converting tds with attributes to <cell>, really blows me off. Also child Tables are pieces i cant able to find a solution.
Could somebody sujest a way for this problem.
|
|
|
|
|
|
hi ramana,
Thnx, for ur help, but if u go through my post, u can see i have already done this ContentType method, but the problem is it will come as a single sheet, what i need is that each of the page i select should come in different excel sheet, Please see if you could do anything in this regard.
|
|
|
|
|
Is it possible to get the complete path of the file using fileupload control.(path which is written in the textbox of fileupload)
getting file is possible but i am unable to find any property which will give me complete path...
well begun is half done
|
|
|
|
|
Probably filename property of the httppostedfile object returns the complete path of the file on the client computer.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks mate it did work...
Sarbjeet Singh
|
|
|
|