|
Hey thanks guys for ya reps, well i wish i would xplain this better,
Here is a piece of code:
below 'files' is the name of my file uploader
HttpPostedFile myFile = files.PostedFile;
string strFilename = Path.GetFileName(myFile.FileName);
if (strFilename != "")
{
string[] lines = File.ReadAllLines(strFilename);
}
Reason: As anyone one else knows, when you choose browse on a file uploader, you can only select a file if it is present in the dialog box that opens.
So if I select a file in my working directory, it works ok but if i select a file 'Outside' my working directory then I receive the error above(file not found).
E.g my working directory is: C:\MyProject\SMS Send\contacts.txt this works
and if I choose: C:\Documents and Settings\Morgan\Desktop\testing.txt this will give a FileNotFound exception,
and when i look at this exception it is pointing to:C:\MyProject\SMS Send\testing.txt which is my working directory. I don't quiet understand why it is searching for the file from my working directory..
Please help
Thanks
Mor
|
|
|
|
|
You need to user Server.MapPath() while retrieving the full path.
e.g:
string strFilename = Server.MapPath(Path.GetFileName(myFile.FileName));//path of a file
I guess this should work now.
When you fail to plan, you are planning to fail.
|
|
|
|
|
Thanks for your reply man but hey this gives me the
same error(FileNotFound Exception)
I don't quiet know why... ![D'Oh! | :doh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_doh.gif)
|
|
|
|
|
Hi all,
What does the below code means?What exactly the secod line tells ...pls help me in this
Application.Lock();
an class="smallblack">Application[“mydata”]=”mydata”;
Application.UnLock();
Thanks In Advance
|
|
|
|
|
reogeo2008 wrote: an class="smallblack">Application[“mydata”]=”mydata”;
This line? It doesn't appear to be complete. But the portion it is showing is placing mydata into an application variable called mydata
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
asp.net program to generate search engine like google to search in the entire solution
Sameer Baig
|
|
|
|
|
You should ask specific doubts that you face/come across while working on something instead of asking full 'asp.net program' for something!
Perhaps you should use search engine google [^]for such queries! ![Thumbs Up | :thumbsup:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/thumbs_up.gif)
|
|
|
|
|
Hai Sandeep,
Actually I got this requirement to implement in a project few days before.You are 100%
correct. Thankyou for your suggession .I will again search in
google and any doubts if I got then you are the best person to clarify it.
Cheers,
Sameer.
|
|
|
|
|
I am implementing url rewriting in my website by using urlrewriter.net(Intelligencia.UrlRewriter) and i am facing problem.
in my web.config i have written
<rewriter>
<rewrite url="~/Products/(.+)-(.+)" to="~/Products.aspx?CategoryName=$1&CategoryId=$2"/>
<rewrite url="~/Product/(.*)/(.*)" to="~/ProductDetails.aspx?ProductId=$2"/>
1) And my href for product is given as:
<li><a href='" & Page.ResolveUrl("~/Products/") & strUrl(notebooks-laptops)& "-" & intCategoryId(222) & "'>" & strMenu(notebooks & laptops) & "</a>
I am having the path now as
http://localhost/Products/notebooks-laptops/222 =>category and its id
but I want
http://localhost/Products/notebooks-laptops
but the search condition in application is through intCategoryId(222) so will require it.
2) In the above web.config code the second rewrite is for details of that product which is clicked.
my url is
http://localhost/Products/notebooks-laptops/345345435->ProductId
But its goes in both page products and productdetails page and finally in products and application get hanged.Is there is any mistake in rewriter code i.e rule in config file
PLease help me me for both the Probelm.Any help is appreciated
|
|
|
|
|
Hy ,
I have a very urgent requirement where i have a pdf file containg all the information in table format.
i have to trasfer it to database .HOw can i do it.
Is it possible to get the data in xlsheet so that i can transfer the data from xl sheet to database
|
|
|
|
|
you have to use converter...pdf to excel.
I know about this one.
1) smart-pdf-converter-pro (trial)
2) PDF to Excel 2.4
May this help you.
!- F - R - I - E - N - D - S -!
|
|
|
|
|
Hello Experts,
I tried the Print Button using remote option..
Print Button is Enabled,but i want that print should come on
Client Machine and not on server side...
Can U Please tell the other way i can use the print option on my report viewer control
M Using RDLC Report
Please Help
Thanks In Adv.
Sharing Of Knowledge Provides Solution....
|
|
|
|
|
|
Dear all,
I have a asp.net page to import some files from the local network and export them to other network locations or upload to ftp servers. the user can configure the import and export locations.
im using also impersonation with a network domain account to set the read/write permissions on the network machines for the page.
The webpage will be used most of the time locally on the webserver, or through lan.
so i can't use iis security settings because everybody who is logged in on the webserver can change the iis settings or the web.config file.
My question is how to secure the page in this situation?
Thanks in advance.
|
|
|
|
|
Priya Prk wrote: everybody who is logged in on the webserver can change the iis settings or the web.config file.
My question is how to secure the page in this situation?
Why would you allow users to change the web.config? How can a user change IIS setting? I think you have more problems with your design than just authentication.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi Mark,
the website will be hosted by the user's company. they can reach it through the local network, but some of them can also log in into the webserver's(iis) pc, in this case they can change the iis or the web.config file. But i want at lease prevent them to use the webapplication.
|
|
|
|
|
You can't. If they have root access they undo any changes you make to the config or settings.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hai iam using ASP.NET C# to develop my project "LEAVE TRACKING SYSTEM"
my question is
**In leave apply page after selecting number of days throough text box and sanctioning authority, i press submit button. here i want to display one message box with the message box like " you are applying leave for 2 days to xxxauthority"
**please dont suggest alert or confirm box because they r showing values in other page that means the background is becoming white.
**i want to display message box on the page where i can able to see controls on UI page in disable mode.
i hope u will reply soon
regards
jyothi
|
|
|
|
|
use javascript modal dialog or use ModalpopupExtender from AjaxControlToolkit.
|
|
|
|
|
luckydear wrote: **please dont suggest alert or confirm box because they r showing values in other page that means the background is becoming white.
This shouldnt be. You are not injecting the javascripts properly. One can see those alerts/confirm on the same page without white space.
Further, if you need to have a disabled look, then place a div on the page before showing the alert/confirm.
|
|
|
|
|
jyothi,
luckydear wrote: **please dont suggest alert or confirm box because they r showing values in other page that means the background is becoming white.
There is nothing like javascript(alert/Confirm) will not help here.
Try to get it like this.on submit button on client click,You should..
btnSubmit.OnClientClick = " return confirm('you are applying leave for 2 days to xxxauthority');"
This will neither allow to access the present page controls,nor navigate to other page.
Regards,
S G
Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail.
Come Forth Yourself to Click "Good Answer" for any expected solution.
Let us Support our C Project Programmers who provide solutions here.
|
|
|
|
|
btnapply.OnClientClick = "return confirm(''you r applying leave for" + totaldays + " days to " + selectauthority + "')";
i have placed this code in btnapply_click. but it is not working.please reply
regards
jyothi
|
|
|
|
|
jyothi,
luckydear wrote: btnapply.OnClientClick = "return confirm(''you r applying leave for" + totaldays + " days to " + selectauthority + "')";
This code has placed before the click event of that button which is being raised(btnapply).Even,You can place this in aspx page also or page load event.
SG
Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail.
Come Forth Yourself to Click "Good Answer" for any expected solution.
Let us Support our C Project Programmers who provide solutions here.
|
|
|
|
|
what u have suggested is not woking.
its ok i have another problem as
----response.write("confirm('some message')");----
this is my code, from this what i want is
* If i press ok button it should do some action and navigate to other page
* If i press cancel no action should be performed and navigate to other page.
please reply me bcoz my project is stopped because of this problem.
|
|
|
|
|
luckydear wrote: ----response.write("confirm('some message')");----
I don't Think so,That Response.write will allow you to execute javascript here.Instead You can go for Page.reg..clientscript(if there is no master page.can You just paste the button onclientclick code here and also aspx button properties mentioned of aspx page here,so that i can tell wat is mistake being done.or mail me the page code to sundeepganiga@gmail.com.I will try to find solu if possible.
Regards,
S G
Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail.
Come Forth Yourself to Click "Good Answer" for any expected solution.
Let us Support our C Project Programmers who provide solutions here.
|
|
|
|