|
Just like I said above, when I type the "\\sitename\wwwroot\appfolder\file.doc" in IE address box, the document will be opened with Word. Is there any way in a asp.net application that can do the same way?
|
|
|
|
|
if( File.Exists(Server.MapPath("...")) )
{
FileStream MyFileStream;
long FileSize;
MyFileStream = new FileStream(Server.MapPath("..."), FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize];
MyFileStream.Read(Buffer, 0, (int)FileSize);
MyFileStream.Close();
Response.ContentType = "application/msword";
Response.BinaryWrite(Buffer);
}
else
MessageBox.Show("File not found!");
This code fragment will ask user download this file. However user can open this file by press open button. Therefore, MSWord will be open.
Is there any suggestion?
|
|
|
|
|
A little history about the issue, I needed an .exe to fire based on the Web Users response. Then, I pick-up the output of the .exe and FTP it to a desired location while keeping an accurate audit trail of these events.
The process has been written and work famously on my localhost, while in debug mode. On the other had, when I run the process on my localhost as IUSER_, I will see the .exe appear in Task Manager but the .exe never executes.
I am about 95% sure it's a permissions issue and IIS config on the site. So, when trouble shouting the issue, I've went as far as allowing Everyone rights to the "C" drive with Full Control and open up IIS with:
Script source access
Read
Write
Directory browsing
I think I've opened up my testing PC as wide as it will go. My question is when within debug mode how do I impersonate IUSER_ permission so I can figure out when I need to add the correct permission for IUSER to execute the .exe? Or any ideas on working around the permission issue. Because, I don't really like the idea that I'm allowing a site to run executables onto my web server. Please help
Robert Fidler
Software/Web Developer
|
|
|
|
|
Hi there,
What do you mean by it's working in debug mode? Does that mean when you are debugging your application or the application is running with the debug attribute set to true in the web.config file. To run and read the standard output of an executable, your application normally requires the trust level, you can check this. Also, you may try to read the standard error from the StandardError property and see if you get any clue from it. Another work-around is to impersonate an window account which is available on the machine. You can configure the impersonation using the identity element in the web.config file or using the WindowsIdentity.Impersonate method in code.
|
|
|
|
|
What is the best way to define money such that sql server and asp.net agree? I have defined money in my sql tables as 'money' and values are stored with 4 places after the decimal point. In asp.net I'm using CompareValidator with DataTypeCheck of type 'currency'. This is raising a problem for me because asp.net permits only two places after the decimal point and throws up a validation error for money values i.e. because they have 4 places after the decimal point.
I would like to define money as having 2 places after the decimal point. How can I achieve this?
Thanks
Majella
|
|
|
|
|
Use a regex validator instead and validate for ^([0-9](\.{0,1})([0-9]{0,4}))$
If you are storing 4 dp in the database, then your users may want to see all four at some point, so you might want to use a decimal datatype in .net and have some sort of formatting function for the front end.
|
|
|
|
|
I want to increase size of imge button at run tim but ,
i did not able to do it
pls tell me how to do it
my code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ImageButton1.Height=ImageButton1.Height+ 120px
ImageButton1.Width=ImageButton1.Width+120px
End Sub
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
End Sub
End Sub
|
|
|
|
|
The Height and Width properties here are Unit types, for which the addition operator is invalid... but I'm not sure that's the way you would want to set them anyway.
I wrote some code to try this and I think Height and Width are being ignored in this context. The following did work (but I have to wonder if there is a better way). It's in C#, but you should be able to follow what's going on. It uses a Session variable to track the current size and increases it on a click of the image. The size is then assigned directly to "height" and "width" attributes (rather than relying on Height and Width properties of the ImageButton).
<% @Page Language="C#" %>
<script runat="server">
const int kDefaultSize = 32;
int GetImageSize()
{
if (Session["imagesize"] == null)
SetImageSize(kDefaultSize);
return Convert.ToInt32(Session["imagesize"]);
}
void SetImageSize(int amount)
{
Session["imagesize"] = amount;
}
void Page_Load()
{
if (!IsPostBack)
{
SetImageSize(kDefaultSize);
ImageButton1.Attributes["height"] = kDefaultSize.ToString();
ImageButton1.Attributes["width"] = kDefaultSize.ToString();
}
}
void BtnClick(object o, ImageClickEventArgs e)
{
int i = GetImageSize();
i = i + kDefaultSize;
SetImageSize(i);
ImageButton1.Attributes["height"] = i.ToString();
ImageButton1.Attributes["width"] = i.ToString();
}
</script>
<html>
<head>
<title>Growing Image</title>
</head>
<body>
<form runat="server">
<p>Click the image to see it grow</p>
<asp:ImageButton id="ImageButton1" runat="server" OnClick="BtnClick"
Src="/help.gif"
/>
</form>
</body>
</html> See if this helps give you some ideas.
|
|
|
|
|
|
Hi
I am trying to get simple HTML formatted text on an image.
I am using FreeTextBox to get the formatting.
How would I keep the formatting and put it on an image?
Or where can I find more information on this and I have spent weeks trying to get this working and can not seem to find anything like this.
Thank you
|
|
|
|
|
Hi there. "formatted text on an image" can mean a few different things to me. Is it that you want to use the GDI+ drawing methods to create an image? or is it that you want to use CSS absolute positioning to place the text element on top of the image element in your HTML web page? or something else?
|
|
|
|
|
hi
say i have:
<code><font color="#000000" size=4>testing <strong>this</strong></font></code>
i want it on an existing image, but exactly as the text would appear in say internet explorer.
...or if i can get a free drawing component for asp.net which "the user" can load the image as a background, and then enter the text in graphics, and save it onto the server...
i have a little image. a user select the image and need to enter information and then it has to be saved on the background as an image...but i need it to be formatted (as described above) as the user wants it...
thank you
pieter
|
|
|
|
|
Hi there. Well, here's one way. It uses a table cell with CSS style elements to set the background image, placing the text in the middle.
<html>
<head>
<title> Positioning with a Table</title>
</head>
<body>
<form runat="server">
<table border="1">
<tr valign="middle">
<td align="center" width="200" height="200"
style="background-image: url(/help.gif);
background-repeat: no-repeat;
background-position: center;
">
<code><font color="#000000" size=4>
testing <strong>this</strong>
</font></code>
</td>
</tr>
</table>
</form>
</body>
</html>
|
|
|
|
|
hi
thank you, but i think i did not make myself very clear. it has to be saved as an image. ie. you must be able to open test.jpg in a paint program and see the formatted text as part of the image. it must be asif you used a text tool in, say, photoshop. when you save it, it has to be part of the image, not text anymore...
thank you
pieter
|
|
|
|
|
|
Hello, I want to create a simple asp page to be rendered on a mobile device (PDA). How can I get to see the size of the page in bytes or something so that I create as light pages as possible because I will be usign GPRS technology to connect to the website and it needs to be very light. Thanx!
Jus Mee
|
|
|
|
|
Load the page in a browser, save the html file to disk and then look at the file properites...
|
|
|
|
|
Hi everyone,
Can we bring a third party tool.Say,Accrobat reader in the browser.I will give a small table or something in the webpage and I have to load the application (Accrobat reader) over here.Is this possible.
Thanks
|
|
|
|
|
Acrobat Reader would have to be installed on the client, which probably wouldn't be an issue as most folks have it installed already. You could try using an <IFRAME> tag where you want your table to be in your web page, then set the source to the .pdf file.
|
|
|
|
|
If you are trying to display a pdf, acrobat reader should run automatically (if installed)
|
|
|
|
|
Infact I want to bring a third party pictureviewer tool.If its already been installed in the client machine,how could it be brought into a frame of the browser.
Can we use the <object> tag of HTML.If so how can we give the classID,Codebase etc .. as I have only the exe of the tool.I tried to bring acrobat reader in the browser by giving its path as classid variable.But it didnt work out.
Now,The question is, can we load an exe in the browser.Say,like acrobat reader has been loaded in a particular portion of the browser and from there its used to open a pdf file,as like normal acrobat reader
|
|
|
|
|
Hi........
it show error login failure in asp.net.
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
i didnt yet use crystal report.
i download the demo code and run.
where i fill this , how i know which table field r used for filling report?
i change only
crReportDocument.SetDatabaseLogon("sa", "sa", "user","analysis")
help me plz
with regards
sumi
reply soon
|
|
|
|
|
sumathi_k wrote: where i fill this , how i know which table field r used for filling report?
I'm sorry. This makes no sense to me.
sumathi_k wrote: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
If your login is failing, it is most likely due to an invalid username/password issue, unless Crystal Reports is using windows authentication, in which case you would want to make sure the ASP.NET process account user has rights to run the report.
|
|
|
|
|
you have to set uo the LogonInfo class correctly
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|