|
What do you want to do exactly?
Whether you want to display the file or download.
If you want to display the .pdf on the client side and there is a probability that user may not install it on system. In that case add download acrobat-plug-in.
For downloading ..........
Dim dwnURL As String = CType(sender, LinkButton).CommandArgument<br />
If dwnURL.Length > 0 Then<br />
Dim filepath As String<br />
filepath = System.Web.Hosting.HostingEnvironment.MapPath(dwnURL)<br />
'Check whether the download file exists or not. if does not exists, send auto-generated email to the admin specificying<br />
'the at which URL it occured and the file which is not found.<br />
If Not System.IO.File.Exists(filepath) Then<br />
Session("FNN_AbsolutePath") = filepath<br />
Session("BackURL") = Request.UrlReferrer<br />
Response.Redirect("~/BrokenLink.aspx")<br />
End If<br />
Dim onlyFileName As String = System.IO.Path.GetFileName(filepath)<br />
' Open File<br />
If Not System.IO.File.Exists(filepath) Then<br />
' popFileNotFound.Link = "" ' ResolveUrl("~/admin/email.aspx")<br />
'popNewMail.Title = GetGlobalResourceObject("mail", "newMail")<br />
' popNewMail.Message = String.Format(GetGlobalResourceObject("mail", "newMailMessage"), _newMailCount.ToString())<br />
popFileNotFound.AutoShow = True<br />
popFileNotFound.Visible = True<br />
Exit Sub<br />
End If<br />
Dim fs As New IO.FileStream(filepath, IO.FileMode.Open)<br />
Dim bytes(fs.Length) As Byte<br />
fs.Read(bytes, 0, fs.Length)<br />
fs.Close()<br />
' Send the file as Response<br />
Response.AddHeader("Content-disposition", "attachment; filename=" & onlyFileName)<br />
Response.ContentType = "application/octet-stream"<br />
Response.BinaryWrite(bytes)<br />
Response.End()<br />
End If
|
|
|
|
|
thanks for replying my mail
the problem what i am getting is i was unabel to open a pdf file link from internet explorer i am using winxpsp2 with IE sp2 when i am clicking the hyper link it unable to open the pdf file.Even it unable to open with window.open method.i used the above method i am getting a error "Thread was being aborted." but the problem is my page search is been stoped with blank,after opening the pdf.
hussamuddin
|
|
|
|
|
I am having a user in Active directory(eg user1) with password(eg user1).If this user changes the password(eg from user1 to u1).Then attempt to change it again he shuld not be allow to use the previous passord(ie Changes from u1 to user1 then Error.if from u1 to uuuu1 then shuld be allowed to change).In short i want to store the password every time the password change take place(ie maintain password history length to 3 in active directory).How can i do all this via C# coding? Plz help me to find a solution to this???
sheets
|
|
|
|
|
|
hi all i want to make web application that is restricted to only four pplz i mean 4 computer and does not allow more than that,and post messages to these visitors after certain time intervals.
Tasleem Arif
|
|
|
|
|
Hi!
I am building a web site in ASP.Net and C# for playing virtual stock game. A registered member
will be given 1 M $ to buy and sell bond,stock...But i am a beginner and have not experience
in this field so i really need help about:
-How to automatic retrieve stock information from a website(eg finance.yahoo.com) and save
it into database.
-How to execute transaction
-Any resource, reference, advice, information about my project.
Thanks in avance and sorry for my bad english.
Best Regards
giaptd
|
|
|
|
|
I develop a web page thru ASP.NET2005 using HTML,CSS. whn i run into these pages Internet Explorer thn they r perfect into formatting but whn I run into these pages ino Mozilla FireFox and Netscape thn they r unformatted.so how can i prevent this sititution.
dcjoshi2
|
|
|
|
|
hi,
This is not the problem of the ASP.NET, this is the problem with the HTML and may be the CSS, because many functionalities supportd by IE are not supportd by other. Also IE can be satified with minimum requirment, but not he Mozilla.To over come this problem you has to first understand the html and use the functionalities suppored by all
Know is Drop, Unknown is Ocean
|
|
|
|
|
If a page doesn't look the same in IE6 and Firefox, it's almost always shown correctly in Firefox.
You have created a page that uses the bugs and quirks of IE6 to make it look the way that you want. As other browsers don't have those bugs and quirks they won't misinterpret the code, so the page looks different.
Here you can read about the bugs: Position is everything[^].
---
b { font-weight: normal; }
|
|
|
|
|
Sir,
I want to check whether sql server is installed or not on the machine before making the connection.
PLease help
Thanks
|
|
|
|
|
Hi
I want to display time and date it showing in my system
But when i upload to server it is showing server time
How can i display Indian time
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
using System;
using System.Globalization;
using System.Threading;
public class FormatDate
{
public static void Main()
{
DateTime dt = DateTime.Now;
// Sets the CurrentCulture property to U.S. English.
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
// Displays dt, formatted using the ShortDatePattern
// and the CurrentThread.CurrentCulture.
Console.WriteLine(dt.ToString("d"));
// Creates a CultureInfo for German in Germany.
CultureInfo ci = new CultureInfo("de-DE");
// Displays dt, formatted using the ShortDatePattern
// and the CultureInfo.
Console.WriteLine(dt.ToString("d", ci));
}
}
Know is Drop, Unknown is Ocean
|
|
|
|
|
Hi Thx for reply
I tryed this code but it is not showing the INDIAN Time (when i upload to server)
Plz check this code
Dim dt1 As DateTime = TimeOfDay
Thread.CurrentThread.CurrentCulture = New CultureInfo("te-IN")
Label4.Text = dt1.Now.ToLongTimeString.ToString()
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Hi,
The above code is correct, Sorry ya i forget to tell you one thing, did you changed the culture="te-IN" in weg.config file??? Plz try this..
<configuration>
<system.web>
<globalization
fileencoding="utf-8"
="" requestencoding="utf-8" responseencoding="utf-8" culture="te-IN" uiculture="de-DE">
Regards
sarathy
Know is Drop, Unknown is Ocean
|
|
|
|
|
HI
I try this one but the solution is not running
Saying that error in weconfig file
Where to put this code in webconfig file
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="te-IN"
uiCulture="de-DE"
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
|
Hi Thx for reply
I got the thing
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
hi everybody
I am going to open Word file through asp.net
for that i wrote following code
using System.Runtime.InteropServices;
using Word;
Private Word.ApplicationClass oWordApplic;
// a reference to Word application
private Word.Document oDoc;// a reference to the document
oWordApplic = new Word.ApplicationClass();
object fileName = strFileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
oDoc=oWordApplic.Documents.Open(ref fileName,ref missing,ref readOnly,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref isVisible,ref missing,ref missing,ref missing);
when executing
oWordApplic.Documents.Open()
Exception Occurs 'The server threw an exception'.
so plz tell me then solution to oversome to this problem
vivek deshpande
|
|
|
|
|
Sir,
in asp.net 2.0 In the code behind file it is written Partial class
and in 1.1 it is only written classWhy it is so?
Thanks
|
|
|
|
|
|
Hi Apurva
The article says
we don't have to declare our controls in the code-behind page, because ASP.NET 2.0 creates a partial page class where it declares the controls for us.
Ok the control declaration is not in ode behind file now but still i am not getting what's the benifit of partial keyword in code behind file.
PLease do some explanation.
Thanks
|
|
|
|
|
You go through the article posted by Satips it will clarify your doubts.
Best Regards,
Apurva Kaushal
|
|
|
|
|
|
Really good one..
Best Regards,
Apurva Kaushal
|
|
|
|
|
hello its very simple thing..
but i'm not getting the solution.i'm using Sql server with asp.net
i have a table with Autoincreament column say id.and some other field
i write the query for inserting data in it.
like this
1) str1 = "insert into CMS_Login(Login_id,Login_Username)Values('','" & txtclientid.Text & "')"
when i use the above statement in Sql Server table it does not increase the value of Autoincreamented column.
2) str1 = "insert into CMS_Login(Login_Username)Values('" & txtclientid.Text & "')"
and when i use the above query then and Upload it on Client server.page give me error.
what should i do?
thanx
|
|
|
|