|
Hi Tadit,
Thanks for answering my question.
could you please explain how processrequest method can receive the ID( id column in database) from text box,then only it could possible to take diffrent images from database based on the id.Also explain how to load the same picture to imange controller.
Regards,
Rajeev K.
|
|
|
|
|
can you try your image
<img src="showimage()"/>
in your handler which will return output as image
regards..
|
|
|
|
|
I used iTextSharp.dll to create pdf. but that works only for text HTML content. if i use images in my page it throughs exception that images are not found...
my Design file
<asp:Panel ID="pdfPannel" runat="server">
Sample Text
<img src="../Images/image1.png"/>
</asp:Panel>
<asp:Button ID="btnSave" runat="server" Text="Save As PDF" onclick="btnSave_Click" />
my method:
protected void btnSave_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=print.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pdfPannel.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
when i click that save button im getting error
Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\Images\image1.png'.
Please tell me is there any alternate solution is there to create pdf.
Thanks in Advance..
|
|
|
|
|
|
In which of the lines do you get that error?
And is that img src="../Images/image1.png" ever shown correctly on your page?
|
|
|
|
|
image is showing correctly in the page. but the error comes when i crteating pdf.
Error comes when i parse the html elements. it takes wrong url path for images.
<pre lang="c#"> htmlparser.Parse(sr);
|
|
|
|
|
And what about using a full URL, i.e. img src="http://www.yourserver.com/images/myimage.jpg" ?
|
|
|
|
|
nouw im developing in Localhost
|
|
|
|
|
I have a webserver that will be running an ASP.NET application and a WCF service.
The ASP.NET application would require the user to log in before he/she can use the WCF service. I want to handle the sessions so that the user will be logged out automatically after a period of time.
This is where I'm stuck, for the WCF application, I can check that the user is still using the system (i.e. the session gets updated every time the WCF application is called) but for the ASP.NET side, I'm just wondering how can I go about joining these 2 together. Because currently, the ASP.NET application would log the user off since what is happening after login doesn't touch the ASP.NET application which means that the user cannot access the WCF service.
I want to know if I can manually handle the ASP.NET sessions so that I can use the same session table (as the WCF service) in the database.
Thanks.
|
|
|
|
|
Even though I now a bit about Web Forms I really know more about programing Window-applications.
I want to make a site using MVC but only the pattern, not the technology.
I read something about object data sources but must you use that?
Can someone please give me an example.
|
|
|
|
|
Google will find lots of samples and general articles that explain the MVC pattern.
Use the best guess
|
|
|
|
|
I have used the follwing code:
The first sheet has the dataset value.But the second shhet doesnt have any value.I dont knw where the second data will be added to the XML writer cod part.
protected void btnExport_Click(object sender, EventArgs e)
{
string procInfo = "type='text/xsl' href='" + "\\transform.xslt" + "'";//Processing info for XSLT
string curdate = DateTime.Now.ToString().Replace(":", "").Replace("/", "").Replace(" ", "");
//string FileName = curdate + "_" + "Details_test.xls";
string TempPath = Server.MapPath("../Uploads");
string XMLPath=TempPath+ "\\Details.xml"; //temp path to store the XML file
string XLSPath = TempPath + "\\Details.xls";//temp path to store the XLS file
//Write the dataset as XML file with some XSLT processing information
using (XmlTextWriter tw = new XmlTextWriter(XMLPath ,
null))
{
tw.Formatting = Formatting.Indented;
tw.Indentation = 10;
tw.WriteStartDocument();
DataSet ds = GetDetails1();
ds.Tables[0].TableName = "Detail1";
DataSet ds1 = GetDetails2();
ds1.Tables[0].TableName = "Detail2";
tw.WriteProcessingInstruction("xml-stylesheet", procInfo);
ds.WriteXml(tw);
//ds1.WriteXml(tw);
}
XmlDataDocument xmldoc = new XmlDataDocument();
xmldoc.Load(XMLPath);
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(Server.MapPath(".")+"\\transform.xslt");
using (XmlTextWriter tw = new XmlTextWriter(XLSPath, System.Text.Encoding.UTF8))
{
tw.Formatting = Formatting.Indented;
tw.Indentation = 3;
tw.WriteStartDocument();
xsl.Transform(xmldoc, null, tw);//Performa XSLT transformation.
}
//Streams the generated XLS file to the user
byte[] Buffer = null;
using (FileStream MyFileStream = new FileStream(XLSPath, FileMode.Open))
{
// Total bytes to read:
long size;
size = MyFileStream.Length;
Buffer = new byte[size];
MyFileStream.Read(Buffer, 0, int.Parse(MyFileStream.Length.ToString()));
}
Response.ContentType = "application/xls";
string header = "attachment; filename=" +"Details.xls";
Response.AddHeader("content-disposition", header);
Response.BinaryWrite(Buffer);
Response.Flush();
Response.End();
}
|
|
|
|
|
I have used the below code.and the corresponding workbooks are added with the data values.
DataSet ds = new DataSet();
Datatable dt1;
dt1 = Details1();
Datatable dt2;
dt1 = Details2();
Datatable dt3;
dt1 = Details3();
ds.Tables.Add(dt1.Copy());
ds.Tables.Add(dt2.Copy());
ds.Tables.Add(dt3.Copy());
using (XmlTextWriter tw = new XmlTextWriter(XMLPath ,
null))
{
tw.Formatting = Formatting.Indented;
tw.Indentation = 10;
tw.WriteStartDocument();
tw.WriteProcessingInstruction("xml-stylesheet", procInfo);
ds.WriteXml(tw);
}
|
|
|
|
|
Hi, friends,
please answer to me.
I want to print to serial printer from asp.net web application,
is it possible?
the printer is using serial port, and small one for printing queue ticket, or billing receipts.
is it possible to print on such kind of printer from the browser?
please suggest me on this.
best regards
|
|
|
|
|
I think instead of printing from the web app that you insert the data into a database then use a desktop app to watch for new records and print them out. That way you can disconnect the web app from the desktop side.
|
|
|
|
|
If i want to develop a 'small' website based on ASP.NET but using a free content management system, what would you strongly recommend.
What is your take on kentico[^] or http://umbraco.com/[^]
|
|
|
|
|
Definitely Umbraco.
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.
|
|
|
|
|
Yes go with Umbraco. It's a good one
|
|
|
|
|
|
|
Good morning,
I'm working on a project where I've to connet to a provider server. This server uses OAuth2 techmology for authentication. You can find the sandbox example here http://sandbox.ihealthlabs.com/contentfiles/files/SandboxAPISample.zip and you can use the credentials sandboxuser@ihealthlabs.com with password 111111 .
OK, this example allows you to access and view the informations with an user but I want to make a log-like page where I will make access and extract the datas of many users and update an our database.
But I don't know where to start.
I found some libraries and examples but always for Facebook, Twitter etc...
The only documentatios that I have is the pdf inside this zip file http://developer.ihealthlabs.com/contentfiles/files/Open%20API%20Protocol.zip
Please, can you help me?
Thank you
|
|
|
|
|
hello sir,
how to bind local Computer drivers in treeview as well Directories using asp.net c#?.
please sir give me source code on Email:- rrajiv91@gmail.com
thanks sir.
|
|
|
|
|
|
i need the solution for configuring IIS for securing web application. Please help me Sir/Madam...
yours truly
S. Sumathi
|
|
|
|
|