Welcome :Guest
Congratulations!!!

Top 5 Contributors of the Month
Sharon Maxwell
 Post New Web Links

## More Related Resource Links

### Response.BinaryWrite help needed

Hi all

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);

Response.BinaryWrite(byteArray);
}

How do i fill the byteArray with the data?

Thanks in advance :)

/Ryan

### problem in consuming WCF service through Window application

I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0

now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error

::::

The document at the url http://72.44.172.77/HRDev3/Service.svc was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

- The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'http://72.44.172.77/HRDev3/Service.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: 'http://72.44.172.77/HRDev3/Service.svc'.

Content Type application/soap+xml; charset

### Problem when displaying a popup window

Hi all,
I am working on a project in which when I clicked a hyperlink a pop up window has to be displayed for 2 pages.
But at first when i did this in javascript it worked, later after i finished the whole coding suddenly an error box displayed that there is an error in webpage and want to debug

### Closing Javascript Modal dialog window after server side event processing

Hello Friends..

Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.

AMit.....

Hi everyone,

I am using a download handler to handle the downloading of files from my website.  I am using a slightly modified code from the Microsoft article http://support.microsoft.com/kb/812406

Everything is working fine and downloading, even with large files, but it does not show the file size for any of the files to download. Even if theyre really small.

Here is my code for the handler

public class DownloadHandler : IHttpHandler
{

public void ProcessRequest(HttpContext context)
{
string path = "";
try
{
path = context.Server.UrlDecode(context.Request.QueryString["src"]).DecryptString();
}
catch(Exception ex)
{
context.Response.Write(ex.Message);
}
System.IO.Stream iStream = null;

byte[] buffer = new Byte[10000];

int length;

string filename = System.IO.Path.GetFileName(path);

try
{
iStream = new System.IO.FileStream(context.Server.MapPath("~/" + path), System.IO.FileMode.Open,



### Problem download file from SQL Server

Hello everyone. I am having an issue downloading files that I have store in SQL Server. I have no problem in a WinForm. What am I doing wrong in my code?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim sch As New clsReport
Dim fileData As New clsReport.Letter
Dim ms As System.IO.MemoryStream = fileData.fil

Dim fil As Byte() = ms.ToArray
Dim nam As String = fileData.name
Dim ext As String = fileData.ext
If Not fil Is Nothing Then
Try
' Response.Clear()
Response.AppendHeader("Content-Disposition", "attachment; filename=" + nam & "." & ext)
' Response.AddHeader("Content-Disposition", nam & "." & ext)
Response.ContentType = "Application/octet-stream"
Response.Buffer = True
Response.BinaryWrite(fil)
Catch ex As Exception
Response.Write(ex.Message)
End Try

End If

End Su

### Problem to install MS SQL 2005 on Window 7 Operating System

Hi, I recently have problem to install MS SQL 2005 on Window 7 Operating System. Setup showing an error for compitability issues. When click on to button to check for solution online, after a while it pop up that No solutions found for Microsoft SQL Server 2005. Any one know solution for this? Is is possible to install Microsoft SQL Server 2008 on Window 7 and migrate data from Microsoft SQL Server 2005 to 2008? Please advice. Appreciate your help. Thanks.

### Response.Redirect in new browser window

protected void ddlPrint_Changed(object sender, EventArgs e)     {         if (ddlPrint.SelectedValue == "All Agenda Items")         {             Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                             Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));         }How can I open following report in new browser window using response.redirect? Thx   protected void ddlPrint_Changed(object sender, EventArgs e)    {        if (ddlPrint.SelectedValue == "All Agenda Items")        {            Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                            Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));        }}

### Problem displaying a page using window.showModalDialog when resizing it.

Hi, I have a page that is displayed using window.showModalDialog, when the page is resized the tables, text boxes and everything else that is in the page with the width 100% doesn't resize (fit the page) unless a post back is used.How can I make the page keep everything in proportion when it is resized without the need to post back?

### Page does not close after Response.BinaryWrite when opened in IE 6 sp 3

Hi all, I currently having problems in closing a page opened using IE 6 sp 3 after Response.BinaryWrite. All other versions of IE it closes fine. This page was opened using window.open. Below is a sample code of what i am trying to achieve: protected void Page_Load(object sender, EventArgs e) {            Response.Clear();  //Specify the document type.  Response.ContentType = "application/word";  //Specify how the document is sent to the browser.  Response.AddHeader("content-disposition", "attachment; filename=MyDasddsaocument.doc");  //Get data bytes from the file and send it to the response.  byte[] bytes = System.IO.File.ReadAllBytes(@"C:\\Temp\\in.doc");  Response.BinaryWrite(bytes);  Response.End();  Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true); } I hope someone  can help me with this issue. Thank you in advance.

### Client download .csv file from server using Response.TransmitFile

I am using the code below to enable clients to download a .csv file from my server.The problem I am having is that when the file is saved to the client computer the file name is prefixed and suffixed with an underscore which leads to a file type of .csv_ which is obviously not a recognised file type.How can I strip the underscores from the file name at the transmit stage?        Dim FileName As String = LstBox1.SelectedItem.ToString        Dim FilePath As String = "~/temp" & FileName        Response.Clear()        Response.ContentType = "text/csv"        Response.AddHeader("Content-Disposition", "attachment; filename=\" & FileName & "\")        Response.TransmitFile(FilePath)        Response.End()

### How to prevent collapsible panel from closing modal window

I have a collapsible panel extender inside a modal window, my problem is that whenever I click on the link button (to expand my panel), the window closes. Does anyone know of a way to avoid this?

### Response.Redirect problem in Google Chrome

I'm building an ASP.NET 3.5 webapplication using VB.NET, and I'm having problems redirecting to another URL when using Google Chrome. Other browsers like IE and Firefox are fine.My data entry forms all have an OK and an Cancel button, which are both handled server-side. The Cancel button just redirects back to the originating page, while the OK button will add or update a database record and then redirect to the originating page.The redirect to the originating page is done by calling the following shared sub on a general utilities class in my appication: Shared Sub Redirect(ByVal p_sURL As String) Dim l_sURL As String = p_sURL.ToLower If Left(l_sURL, 1) = "~" Then Dim l_oControl As New System.Web.UI.Control l_sURL = l_oControl.ResolveUrl(l_sURL) End If If Left(l_sURL, 1) <> "/" Then If Left(l_sURL, 7) <> "http://" AndAlso Left(l_sURL, 8) <> "https://" Then l_sURL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) & wsUtils.SiteRoot & l_sURL End If End If HttpContext.Current.Response.Redirect(l_sURL) 'HttpContext.Current.Response.Redirect(l_sURL, False) End Sub As you can see, I've tried using the extra argument in the Response.Redirect call, but that

### Closing window in javascript without confirmation

Hello! I need to open a browser window without Toolbars, Status bar and Explorer bars (this means no back, refresh, ... buttons, no histiry, no nothing visible in this browser window). This is what I do: from normal browser window I open new window with all the properties I need and than I close the first window: <body>     <script type="text/javascript">  window.open('login.aspx','','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,                        left=0px, top=0px,width=1024, height=768');  window.close();     </script> </body> This would be OK if the first window would just close, but it doesn't. I get the confirmation window with this text: The Web page you are viewing is trying to close the window. Do you want to close this window? I don't want user to have to close the window manually. Can somebody please tell me how to close browser window without the confirmation popup? Thnx in advanced, dvale