View Complete Post
Im new to .NET and stuck now, so i hope anyone can help my with my problem.
I have a MS SQL database where i have stored some documents as Binary data. I cant figure out how to retrieve them and show/download them in my browser.
I found some guides online and have try to put something together.
private void Write()
int id = 0;
string strID = Request.QueryString["id"];
int.TryParse(strID, out id);
var db = new ModelDataContext();
var doc = db.DocumentDatas.Where(x => x.ID == id).FirstOrDefault();
byte byteArray = File.ReadAllBytes(doc);
How do i fill the byteArray with the data?Thanks in advance :)/Ryan
I'm in the middle of migrating servers and on the new server Response.Redirect is extremely slow. It takes around 20 seconds for the browser to get the redirect. This is something that was quick on the existing server. It's an ASP.NET 2.0 application, both servers are running IIS6.
Additionally, if I "manually" do the redirect, it's fast. For example:
takes around 20 seconds on the new server
Response.Status = "302 Moved Temporarily";Response.AddHeader("Location", url);Response.End();
is fast on the new server.
Any ideas why Response.Redirect would be so slow on the new server?
MSDN Magazine January 2010
This month we show you how to use F# to perform HTTP request-response testing for ASP.NET Web applications.
MSDN Magazine July 2009
Did you know you can use Windows PowerShell to perform lightweight request/response testing for an ASP.NET Web app? Here's how.
Dr. James McCaffrey
MSDN Magazine May 2008
Speech Server 2007 lets you create sophisticated voice-response applications with Microsoft .NET Framework and Visual Studio tool integration. Here's how.
MSDN Magazine April 2008
With queued calls in Windows Communication Foundation you can perform work in a disconnected manner by sending messages through Microsoft Message Queuing. Juval Lowy explains.
MSDN Magazine February 2007
MSDN Magazine July 2001
I need to open a new window with Response.Redirect, Is it possible?
Hi guys, I've been struggling with this for some time now, but I can't figure out why it's not working. I got a gridview in which I'm selecting a specific row. This gives me a string back, which is used to load some data inside a datatable, using DAL The callback works and it's also giving the correct string to retrieve the wanted data. But when I'm trying to use this fresh data update my reportviewer (.rdlc) nothing happens. For now I'm testing the event with a simple button, but even with the button nothing happens. Does anyone know what I'm missing The DAL is working correct and I'm using .NET 3.5
<rsweb:ReportViewer ID="ReportViewer" runat="server" Font-Names="Verdana"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" >
<LocalReport ReportPath="Office\Reporting\InvoiceReport.rdlc" />
protected void Button1_Click(object sender, EventArgs e)
string strInvoiceId = "603663";
tblInvoiceTableAdapter InvoiceAdapt = new tblInvoiceTableAdapter();
TGU.tblInvoiceDataTable invoiceDt = InvoiceAdapt.GetIn
Hello, I will try to be as clear as I can be. I'm sure this question has been asked but I can't find a suitable answer for this particular situation.
I need to be able to redirect the browser to a new 3rd party page while at the same time supplying a cookie required for some form of authentication on the 3rd party site.
I have managed to get this to work in the following manner:
'SessionID is predetermined by another HttpWebRequest/Response
Dim sessionCookie As New Cookie("ezproxy", sessionID.Substring(1), "/", ".someother.site")
Dim CookieJar As New CookieContainer
rRequest = HttpWebRequest.Create("where I want to go")
rRequest.CookieContainer = CookieJar
rRequest.Method = "GET"
'Make the request and get the response.
rResponse = rRequest.GetResponse()
If (rResponse.Cookies.Count <> 0) Then
For Each cook
I am trying to create a web service that can do the following functionality:
<?xml version="1.0" encoding="UTF-8"?>
<Authentication UserName="test" Password="test" MyId="0987">
Response XML - After authenticating request xml from client send them back the following response:
<?xml version="1.0" encoding="UTF-8"?>
How can I create web service to do this.
My company is in the final development stages for a web
application that includes a couple of features that allow for uploading and
downloading user document files. We've
recently identified a problem in these features when users download and view a
document in Firefox. The download and
viewing work fine, but as soon as the user closes the document and attempts to
navigate to a different page in the application, Firefox throws up a page that
Error: not well formed
Location: (URL of page)
Line number: X, Column: X
[a snippet of markup from the page]
I've tried numerous variations on the code we're
using to do the download, but they all center on the following:
string path = Server.MapPath(UIUtils.GetRepositoryPath(custNm)) + fileId + ArtifactRevision.FileExt;
FileInfo file = new FileInfo(path);
throw new ApplicationException("Missing repository file");
fileName = fileName.Replace(' ', '_');
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.ContentType = contType;
This is what I'm trying to do when I get the error on the server (it works on my local machine):
System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image); image.Dispose();
Response.ContentType = "image/bmp";bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp);bmp.Dispose();
I don't think it can be a permissions problem because this works on the server:
System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image);image.Dispose();Response.ContentType = "image/jpeg";bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);bmp.Dispose();
So how do I get this to work for a bitmap?