|
Dim myFolderName as String = "c:\myfolder"
System.IO.Directory.CreateDirectory(myFolderName)
plz covert it into c#
|
|
|
|
|
string myFolderName = @"c:\myfolder";<br />
System.IO.Directory.CreateDirectory(myFolderName);
|
|
|
|
|
I have developed a web application in which i create some temp files in a temp directory with in appdomain's current directory.
What i want to do is to delete all these files when application starts?
Accordingly i have placed code in Application_Start event of Global.asax file. When i run application through IDE then all temp files get deleted. But when i access the application straight away by typing the url in web browser then it doesn't deletes temp files.
How can i solve this problem?
Thnx in advance
Praveen
|
|
|
|
|
Is it possible to add any code or html in a web page to disable the "Save" ,
"Save As" in the File menu and "Source" option in the view menu of a web
browser. I already have code that disables the right click on a page but I
would also like to disable the View Source and Save/Save As option in the
top menu of the browser. I have tried looking on MSDN's website but I have
not been able to find anything because it is so much info on it.
Sathiyaraj Ganesan
|
|
|
|
|
I have heard of code that does parts of that in some browsers. There is however no code that will do that on all browsers, and there is no code that will cover all the other possibilities to view the source code. You can easily circumvent anything like that by simply using another browser, disable Javascript, get the file from the cache folder, or use some other program to request the page.
What do you have in the source code that you think is worth protecting anyway?
---
b { font-weight: normal; }
|
|
|
|
|
I think you do not need to do that because someone always can get the source as long as the page is accessable from internet.
|
|
|
|
|
Hi
Sorry for re posting
But still i am trying this
I am trying to inserting EMP time like Entering And leaving time in office
Now i want to calculate like this
EX:
---
Time1 = EnteringTime - BreakTime
Time2 = BreakTime - LeavingTime
TotalTime = Time1 + Time2
---------------------------------
Time1 = 9:00 am - 2:00pm (Result : 5 hours)
Time2 = 3:00pm - 6:00pm (Result : 3 hours)
TotalTime = Time1 + Time2 (Result : 8 hours)
---------------------------------
Plz Can any one give me an Idea On this
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
hi
datetime time1 = convert.Convert.ToDateTime (entering time);
datetime break = convert.Convert.ToDateTime (break time);
TimeSpan span1 = break.Subtract(entering time);
datetime break = convert.Convert.ToDateTime (break time);
datetime time2 = convert.Convert.ToDateTime (leaving time);
TimeSpan span2 = leaving time.Subtract(break time);
timespan total = span1.add(span2);
try this u'r problem will be solved
cheers
vijay
|
|
|
|
|
HI
THX For Reply
I got it
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
hi
iam storing binary format of the images in db.Now i want to display them on my page with other details.Actually my db table contains many fields .on datagrid iam displaying twofields like eno,ename...and i have taken two link buttons (view and modify)view is to view the full details of the particular employee.when the user click the view link the details will be shown in new seperate window(target=_blank).here my image are displaying properly for all the records.My problem is with modify link.when user click the modify link iam displaying all the details for modification in nxtpage(target=_self). .here my image is not displaying properly.first time for accessing the record it is displaying the image properly.if i am going for another record for modification it is showing only the previous image.if iam refreshing the page then only it is showing the particular image properly how to rectify this problem.whether i have to clean browser cache for every request.If yes how?
// here is my code
private void Page_Load(object sender, System.EventArgs e)
{
int Eno;
Eno = int.Parse(Request.QueryString.Get("eno"));
try
{
if (!Page.IsPostBack)
{
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["strConn"]);
SqlCommand cmd = new SqlCommand("select ENO,ENAME,GENDER,EDOB,EAGE,EDOJ,ESALARY,EPHONE,EADDR,EPHOTO from register where ENO="+ Eno +"",conn);
SqlDataReader dr;
conn.Open();
dr = cmd.ExecuteReader();
dr.Read();
Employno1.Text = dr[0].ToString();
Employname1.Text = dr[1].ToString();
string Gendervalue = dr[2].ToString();
Gendervalue=Gendervalue.TrimEnd();
//Response.Write("|" + Gendervalue + "|");
if (Gendervalue.Equals("male"))
{
RadioButton1.Checked = true;
RadioButton2.Checked = false;
}
else
{
RadioButton2.Checked = true;
RadioButton1.Checked = false;
}
//string exdate = dr[3].ToString();
Employdob1.Text = dr[3].ToString();
Employage1.Text = dr[4].ToString();
Employdoj1.Text = dr[5].ToString();
Employsalary1.Text = dr[6].ToString();
Employphno1.Text = dr[7].ToString();
Employaddress1.Text = dr[8].ToString();
// Create a new stream to load this photo into
FileStream stream = new FileStream("c:/inetpub/wwwroot/Project1/personimage2.bmp",FileMode.OpenOrCreate,FileAccess.Write);
BinaryWriter bw = new BinaryWriter(stream);
byte[] buffer = new byte[stream.Length];
buffer = (byte[])dr[9];
bw.Write(buffer);
bw.Close();
stream.Close();
Image1.ImageUrl="http://new4/Project1/personimage2.bmp";
dr.Close();
conn.Close();
}
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
thanks
vijay
|
|
|
|
|
hi
may ur problem solve tht link so use and get
http://www.programmingknowledge.com/ImageUpload.aspx
use
to show image on page
Response.BinaryWrite(imageData);
dcjoshi2
|
|
|
|
|
Does anyone know if there is a .net version of PHPMyAdmin but more for MS SQL databases ?
Basically I'm looking for an open-source web-based database management tool.
|
|
|
|
|
|
Check the Sql Server Management Studio Express
keep Learning and you never will be out of date...
|
|
|
|
|
Hello,
In my GridView I have a HyperLink Field where I set the DataNavigateUrlFormaString
MyHyperLinkField.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture=" & System.Threading.Thread.CurrentThread.CurrentCulture.ToString()
I believe {0} retrieves the value of my datasource column with index 0. That value is "News".
What I get when I copy the link when previewing the page is:
http://localhost:1717/JaquelineRoxoAtelier%202006a/RSS.ashx?c=News
The part "http://localhost:1717/JaquelineRoxoAtelier%202006a/" is the web site url in my localhost but then I can't see the culture value and everything else is strange.
In my GridView all the QueryStrings I am building look strange and don't work.
Could somebody help me out?
Thanks,
Miguel
|
|
|
|
|
Hello,
Could someone help me out with this?
My QueryStrings are getting all messed up.
I created the GridView at runtime. I am posting my entire code with **** in the code lines which I think are giving me the problem.
Could somebody help me out with this? I tried everything I could think off.
Private Sub gvRSSChannels_Init(ByVal sender As Object, ByVal e As EventArgs) Handles gvRSSChannels.Init
' Define gvRSSChannels properties
With gvRSSChannels
.AutoGenerateColumns = False
.BorderStyle = BorderStyle.None
.DataSource = gvRSSChannels_DataSource()
.GridLines = GridLines.Horizontal
.ShowFooter = False
.ShowHeader = False
End With
' Create, define and add icon template field
Dim tfIcon As New TemplateField
tfIcon.ItemTemplate = New gvRSSChannelsTemplate(Me, ListItemType.Item)
gvRSSChannels.Columns.Add(tfIcon)
' Create, define and add name bound field
Dim bfName As New BoundField
With bfName
.DataField = "Channel"
End With
gvRSSChannels.Columns.Add(bfName)
' Create, define and add url hyperlink field
Dim hfUrl As New HyperLinkField
With hfUrl
.DataTextFormatString = "Me.GetLocalResourceObject(""String.{0}"").ToString()"
.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture=" & System.Threading.Thread.CurrentThread.CurrentCulture.ToString() ' ****
End With
gvRSSChannels.Columns.Add(hfUrl)
End Sub
Private Sub gvRSSChannels_Load(ByVal sender As Object, ByVal e As EventArgs) Handles gvRSSChannels.Load
' Bind GridView to its data source
If Not IsPostBack Then
gvRSSChannels.DataBind()
End If
End Sub
---- Template CLASS ----
' rRSSChannelsTemplate
Public Class gvRSSChannelsTemplate
Implements ITemplate
' Define parent page
Private parent As RSS
' Define template type
Private type As ListItemType
' Create new template
Sub New(ByVal parentPage As RSS, ByVal templateType As ListItemType)
' Define parent page
parent = parentPage
' Define template type
type = templateType
End Sub
' Define template
Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
' Select template type
Select Case type
Case ListItemType.Header ' Header template
Case ListItemType.Item ' Item template
' Create item template controls
Dim rtrhlIcon As New RssToolkit.RssHyperLink
' Add item template controls handlers
AddHandler rtrhlIcon.DataBinding, AddressOf rtrhlIcon_DataBinding
' Add item template controls to gvRSSChannels
container.Controls.Add(rtrhlIcon)
Case ListItemType.EditItem ' Edit Item template
Case ListItemType.Footer ' Footer template
End Select
End Sub
' rtrhlIcon data binding and properties
Private Sub rtrhlIcon_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
' Define rtrhlIcon
Dim rtrhlIcon As RssToolkit.RssHyperLink
rtrhlIcon = CType(sender, RssToolkit.RssHyperLink)
' Define rtrhlIcon container
Dim container As GridViewRow
container = CType(rtrhlIcon.NamingContainer, GridViewRow)
' Define rtrhlIcon properties
With rtrhlIcon
.ChannelName = Me.parent.GetLocalResourceObject("String." & DataBinder.Eval(container.DataItem, "Channel")).ToString() ' ****
.ImageUrl = Me.parent.GetLocalResourceObject("rtrhlIcon.ImageUrl").ToString()
.IncludeUserName = "False"
.NavigateUrl = "~/RSS.ashx?Channel=" & DataBinder.Eval(container.DataItem, "Channel") & _
"&Culture=" & System.Threading.Thread.CurrentThread.CurrentCulture.ToString())
.ToolTip = Me.parent.GetLocalResourceObject("String." & DataBinder.Eval(container.DataItem, "Channel")).ToString() ' ****
End With
End Sub
End Class
Thank You Very Much,
Miguel
|
|
|
|
|
I have a dataset which gets a lot of configuration and client specific data from a XML file. This dataset needs to be used across the whole web application, but the data in the dataset will not be changed by the app. I am looking at the various ways of doing it, but cannot decide. I need to keep performance in mind since our clients are growing. What is the best way to do it? Global assembly cache? application cache? I think application cache has big impact on performance? any other ways?
|
|
|
|
|
As the data isn't changing, I would think the Application cache would be fine.
|
|
|
|
|
Try a session dataset var, it works for me
keep Learning and you never will be out of date...
|
|
|
|
|
hi guys i have a simple asp.net website which is linked to an mc sql database
so far when i tested it on my computer it works how ever when i try to put the files inside the web hosting the connection between the 2 dont seems to be working.
this lead me to thinking i need to put some kinda connection between the database and the main web.
could any one pls tell me the procedure that i have to do from testing from vb.net to a real web host.
|
|
|
|
|
It depends a lot on your host, doesn't it?
I'm guessing you are using Sql 2005 Express for development? Check with your host - they may have utilities to upsize an Express database to a bonafide Sql Server 2005 installation.
|
|
|
|
|
well you see.
i heard that i had to change my connection string and stuff in all my files(not sure)
change my web.config connection string.(not sure)
this are the 2 procedure i heard that i need to do
however after i done this 2 my web site still look like this =P
www.duoultra.com/miratech
|
|
|
|
|
And what does your host say about this?
|
|
|
|
|
Pasting the connection string is not enough, you must also call the connection string from places to activate the string.
Are you calling the connection string anywhere? If so, please check the script on that side. There are also many online tutorial available on ASP .NET.
Since we did not write the script for you, it is impossible for us to go through the script and find out what is wrong with it. The error you are getting now
is because you have not called the connection string anywhere in your script.
|
|
|
|
|
I guess the original point I wanted to get to was in what medium was your data stored. What are you using in your development environment? Is it Sql Express? Is it full Sql Server?
If it is Sql Express, you are most likely not going to be able to simply copy the .mdf file and expect it to work (even with connection strings pointed correctly). It is likely that your host does not support Sql Express and would not have the necessary services running on their servers for Express to work. That's why I originally said to check with your host.
Typically, a host will support a full Sql Server edition (not the Express edition). In this case, assuming you've purchased Sql Server hosting as part of your plan, you would need to upload the data from your Express file to the host's Sql Server database. Again, I would check with your host on this. It is possible that they have tools to help with this kind of [Express->to->SqlServer] upload.
Once you have the data loaded in the format expected by your host, then you would look to modify connection strings in your application (hopefully you're using the <connectionStrings> web.config section for this) to properly point to the host's database.
|
|
|
|