|
Does Ejs template only work with get request because as in my code when I'm using it with GET request it is totally working. IF it is yes, then how can I route my ejs page with POST request because when I am using it with POST request it says CANNOT GET error.
|
|
|
|
|
I have an ASP.Net Web API. When I run it locally it works fine. I installed it on a server in IIS.
When I run http://192.168.51.74:8092 I get the file listing, so it looks like it's seeing the site.
When I try to hit a controller, like http://192.168.51.74:8092/api/Operator/GetAllOperators/, I get a not found.
I'm pretty new to this. Anyone know what I'm doing wrong? How do I debug this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Unfortunately, there are about a thousand possible causes for this.
A big one is the configuration of the AppPool that you're using. It should be set for Integrated, 4.0+, and if you compiled your app for "Any CPU" you'll need select advanced settings and set the "Enable Support for 32-bit applications" to true.
Or it might be that the appropriate handlers or modules aren't being loaded. A common work-around for that is to go to the project web.config and add this attribute to the system.webservser.modules attribute runAllManagedModulesForAllRequests="true".
Or something else. I hope you're getting traction on this!
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
I'm working on simple crud in laravel.I already built Controller,form, and model.But everytime i click the submit input.They always return this url and show 404 not found error,instead of insert the data.Can someone help me to find the problem?i have no clue about this part.
http://127.0.0.1:8000/POST?_token=bD5c3O0XpfTX7NWL7RA7wXSw3rWrQ12fbGLMw0kf&kode=galih&nama=galih&submit=Submit[^]
I set the route using Route::resource('urusan','MasterUrusanController)
Insert Form
<form action="POST" action="{{url('urusan')}}">
{{ csrf_field() }}
<table>
<thead>
<tr>
<td>Kode Urusan</td>
<td><input type="text" name="kode"></td>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Urusan</td>
<td><input type="text" name="nama"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" class="btn btn-primary" value="Submit"></td>
</tr>
</tbody>
</table>
</form>
Insert Form
<form action="POST" action="{{route('urusan.update',$urusan->kode_urusan)}}">
{{ method_field("PUT") }}
{{ csrf_field() }}
<thead>
<tr>
<td>Kode Urusan</td>
<td><input type="text" name="kode" value="{{$urusan->kode_urusan}}"></td>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Urusan</td>
<td><input type="text" name="nama" value="{{$urusan->nama_urusan}}"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" class="btn btn-primary" value="Update"></td>
</tr>
</tbody>
</form>
</table>
Controller
class MasterUrusanController extends Controller
{
public function index()
{
$urusan=MasterUrusan::all();
return view('master_urusan.select',['urusan'=>$urusan]);
}
public function create()
{
return view('master_urusan.insert') ;
}
public function store(Request $request)
{
$data=new MasterUrusan();
$data->nama = $request->get('kode');
$data->nama = $request->get('nama');
$data->save();
return redirect('/urusan');
}
public function edit($kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
return view('master_urusan.update', ['urusan' => $data]);
}
public function update(Request $request,$kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
$data->nama = $request->get('nama');
$data->save();
return redirect('/urusan');
}
public function destroy($kode_urusan)
{
$data = MasterUrusan::where('kode_urusan','=',$kode_urusan)->firstOrFail();
$data->delete();
return redirect('/urusan');
}
}
modified 12-Mar-19 5:47am.
|
|
|
|
|
Galih indra waspada wrote:
<form action="POST" action="{{url('urusan')}}">
You've specified the action attribute twice. The first one should be method :
<form method="POST" action="{{url('urusan')}}">
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi
I use below command On my app for making a password-protected zip file.
def make_zip_heroku(filename,zip_file_pw):
""" This is just usual zip app that exist on ubuntu/linux/etc """
print("Start make zip archive")
zip_file_pw = "-P "+zip_file_pw
OutPutArchive = str(filename)+".zip"
rc = subprocess.call(['zip', OutPutArchive, filename, zip_file_pw, '-9'])
return OutPutArchive
make_zip_heroku("some_file","123")
after zip file saved.. i use an API and upload file to remote server and access it in my PC
But Problem is :
I can't open file with password "123" that i set.
1- I check checksum of my file when created by server and check it when i download my file on windows..
checksum string is same...
2- My zip file size is 80 MB
3- maybe zip command make archive using ..i dont know what method of archiving that can't be work on windows..
Thanks.
|
|
|
|
|
I've been banging my head against what should be an incredibly trivial action -- popping up a "Please wait" dialog (with or without a progress indicator) while a long-running process happens from a System.Web.UI.Page object.
The basic launch is from a button handler routine in my code-behind:
Protected Sub GoBtn_Click(sender As Object, e As EventArgs)
OpenPopup()
DoMenuGeneration()
GenerateStatusDivVisible = False
ClosePopup()
End Sub
DoMenuGeneration() is the long task, it launches an external application (twice even) and blocks until the process is complete.
OpenPopUp() and ClosePopup() have taken many forms, the most promising were AjaxToolkit-based functions fired by javascript using ScriptManager.RegisterStartupScript, but while those popups *can* be made to auto-magically pop up based on a client-side button on the page being clicked, I cannot mimic that click through the ScriptManager. I either get an error (cannot find the control) or simply nothing happens as the code line is executed.
The first attempts were the most simplistic, the "pop-up" is just a named DIV tag with runat=server, and I manipulate the Visible property. As far as I can tell, the page simply doesn't render in between, so making the DIV visible has zero effect.
I've tried at least three different "solutions" given on the web ... so far none have even come close to working properly. I have tried:
So far ... nothing has worked.
Thanks in advance!!
|
|
|
|
|
Consider what is happening:
- You click the button;
- The browser posts the form to the server, and waits for a response;
- The code behind, which runs on the server, receives the request, and:
- Registers a startup script to display the dialog;
- Runs the lengthy process;
- Registers a startup script to close the dialog;
- Renders the response and sends it back to the browser;
- The browser receives the response and replaces the document.
- The browser executes the two startup scripts, displaying and immediately closing the dialog.
What you want to happen:
- You click the button;
- A Javascript method displays the dialog;
- The browser posts the form to the server and waits for a response - preferably using an AJAX request or an UpdatePanel;
- The code behind, which runs on the server, receives the request, and runs the lengthy process;
- The browser receives the response and updates the document;
- A Javascript method closes the dialog.
3 Different Ways to Display Progress in an ASP.NET AJAX Application | DotNetCurry[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
or not as expected.
if you look at this site[^] (dutch website)
I would like to have the tab content (made in JQuery) with a margin of around 25 pixels on either side (left and right) of the page, regardless of the content. (so it moves with the size of the browser).
For now, I did a dirty fix by setting the min-width to a certain amount of pixels, which is not what I want, but otherwise the width would adapt to the content of the tab. For the tab "programma" eg. only half the width of the page would be filled, the rest is the background image.
No matter what I did in the css, nothing worked. (although it looks trivial)
So what do I need to do to
* remove the fixed pixel width
* make the tab content as wide as the page (with a small offset of say 25 pixels left and right.
It COULD be the JQuery css that's messing things up, but I'm not a css/jquery wiz unfortunately.
the short HTML:
<body>
<div id="divparent"><br />
<div class="header"> title, social media stuff, ... </div>
<div class="main">
<div id="tabs">
<ul>
<li><a href="#tab-home">home</a></li>
<li><a href="#tab-club">club</a></li>
<li><a href="#tab-programma">programma</a></li>
<li><a href="#tab-inschrijvingen">inschrijvingen</a></li>
<li><a href="#tab-gedragscode">gedragscode</a></li>
<li><a href="#tab-info">informatie</a></li>
<li><a href="#tab-kalender">kalender</a></li>
<li><a href="#tab-faq">FAQ</a></li>
<li><a href="#tab-contact">contact</a></li>
</ul>
<div class="tabcontent"><!--</div>
</div>
</div>
<div class="footer">footer contents</div>
</div>
</body>
the css:
div.header { display: inline-block; }
div.main { margin: 0px 0px 0px 0px; }
div.tabcontent { margin: 0px 0px 0px 0px;min-width:1200px; }
div.footer { text-align:center;font-size:small;border-top:1px solid #F0F0F0;background-color:#1E1E1E;}
div#divparent { margin: 25px 25px 25px 25px; }
div#tabs { }
many thanks for your help !
modified 11-Mar-19 9:10am.
|
|
|
|
|
You have position:absolute; on the <body> element. If you remove that (and the min-width hack), the tab fills the width of the screen.
If you genuinely need the body to be absolutely positioned, you'll need to force the body width by adding min-width: calc(100vw - 26px); to it. But that's slightly hacky, since 100vw includes the width of the vertical scroll-bar, and there's no simple way to account for it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
body was indeed working in the back of my mind, though I was convincing myself the div would override the body.
The background was moving, but I fixed that with adding background-attachment: fixed; and the site looks far better now!
thanks!
|
|
|
|
|
My question is a little vague and not simple but I will try to be as concise as possible.
1. I want to create a new website from scratch.
2. I am a professional developer but have limited web experience.
3. I have extensive C# experience and my small amount of web experience has been on ASP.NET WebForms. For this reason, I would like to stick with Microsoft technologies.
4. It is almost 100% likely I will be the only person working on the site.
5. Initially the site will be no more than 10-20 pages and can probably be static HTML/CSS.
6. Even if the site becomes successful, still it is unlikely to get any tougher than maybe being able to query a back-end database, maybe have a login facility, maybe host a blog, maybe a shopping cart. But even if all of this does one day happen, the visitor numbers are likely to be tens-per-day.
I would like to move away from Web Forms because it seems to be too complex for my needs and because of this I find I never update the site.
I was thinking of recreating the site initially as static HTML/CSS but I like the idea of being able to add small chunks of Razor code here and there, to keep my options open if I need to add something I can't do in HTML.
So I was wondering if I can do this. Can I use Visual Studio to create a simple HTML/CSS web site that allows me to add bits of Razor code if needed? If I can do this, presumably I could later progress onto a more formal MVC architecture if I felt it was needed?
And one final part to this question: should I be looking at vanilla Razor or would I be better looking into Blazor?
Any help or advice would be very gratefully received.
Kind wishes ~ Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Are you looking for Razor Pages[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for the reply, Richard.
I have visited the page you linked in my many travels on the subject but I quickly became unclear about how Razor could in any way stand alone from MVC. Having looked again at the page, I note that there is a separate link for Razor using MVC so I guess that implies what I am looking for is also contained somewhere in that section of MSDN.
I'll do more research. I was just hoping to get a few informed comments about my general approach since I don't have too much free time to spend on this and ideally don't want to waste what time I do have wandering down a blind alley.
Thanks again for your reply.
- Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Razor is a view engine, just as ASPX is a view engine.
The main difference between the two is that ASPX was developed based on the web-forms page model and was adapted for use with MVC.
Razor, on the other hand; was built atop the MVC page model and there has been no official adaptation to any other page modeling.
There was a Codeplex project for Razor, now on GIT; and a couple years old:
GitHub - Antaris/RazorEngine: Open source templating engine based on Microsoft's Razor parsing engine
There is also a 2-part blog set about how it's put together
Dissecting Razor, part 1: Parts of the framework – SLaks.Blog
With your personal website, I would probably just build an empty MVC project and just fill the Views with your static HTML. Not the most efficient way to do it, however; you will have the framework present to start learning Razor and MVC.
As for Blazor, it still is a little young and I don't see too much going on with it to build/promote this.
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
That's very helpful! Thank you!
I'll take some time to digest what you've written and I'm sure I'll be better informed to decide upon a way forward.
- Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
Hi All,
I am little (a lot in fact) hazy on ASP.NET authentication methods...
At any rate I am trying to diagnose the following problem on an existing web app that use OpenID to query our ADFS server to authenticate users.
We followed that process:
https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configuring-alternate-login-id
And the AlternateLoginID is a custom LDAP attribute (namely interactUsername )
With some custom C# code I created a an AD user with the following properties:
UPNLogon: IU-3762@licensys.com
SAMAccountName: dev\IU-3762
interactUsername: llandersxA
when I try to login with llandersxA on the ADFS login page, it tells me:
Incorrect user ID or password. Type the correct user ID and password, and try again.
And replace the user name I entered (llandersxA ) with dev\llandersxA before trying again (which is not recognised either)
Any idea on what I might be missing? or link that could help on that topic?
Cheers!
[EDIT] the plot thickens!
If the interactUsername looks like an email, say llanderxA@foo.bar it works!
modified 4-Mar-19 22:33pm.
|
|
|
|
|
When developing (a relatively simple) web page, what is the best way to add a menu to it. I noticed that the HTML tag <menu> has been depreciated. I also see that it has been brought back in HTML 5.0 so I am a bit confused. Please comment. Also could somebody point me to a good tutorial on menus in HTML?
Thanks,
Bob
|
|
|
|
|
You may want to consider looking a Bootstrap for developing web pages.
A good reference site is: W3schools.com
|
|
|
|
|
jQuery has a nice and easy menu.
Look in the jQuery UI.
It helps if you have knowledge of javascript and css. (before you download the library, you can define your own custom stylesheet attached to it)
of course there are other libraries or you can download pure html/css examples.
|
|
|
|
|
If you're asking what is the easiest way to implement then consider comments above. Although there is a belief that it's not necessary to load a huge CSS framework or JS library for such a simple task (keep in mind that not all users access your site from a laptop or via good internet, so huge CSS/JS libraries may cause unresponsiveness for quite a long amount of time which will negatively affect UX).
If you're asking instead what is the most appropriate HTML tag - consider nav
Although you can really get away without it, the whole HTML5 thing is about tags that have some semantics behind them, showing what the part of a markup really does.
|
|
|
|
|
I'm using a WebAPI in my app. When I run it, the browser opens. When I stop the app, the browser closes...
...at least it USED to. Now the browser stays open.
I have no idea what changed. Anyone know what this is?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I have datalist with imageButton generated from folder with Images. I am trying to change border on clientClick event to indicate that user selected that image. I was able to get click event for image but how to I unselect others images?
function ccSelectedImage(e) {
{
alert(e);
e.style.border = "1px solid Red";
return false;
}
}
<asp:datalist id="dtlist" runat="server" repeatcolumns="20" cellpadding="1">
<itemtemplate>
<asp:imagebutton id="Image1" runat="server" bordercolor="White" onclientclick="ccSelectedImage(this); return false;"
="" imageurl="<%# Bind("Name", "~/Images/{0}") %>">
Dim dir As DirectoryInfo = New DirectoryInfo(MapPath("Images"))
Dim files As FileInfo() = dir.GetFiles()
Dim listItems As ArrayList = New ArrayList()
For Each info As FileInfo In files
listItems.Add(info)
Next
dtlist.DataSource = listItems
dtlist.DataBind()
|
|
|
|
|
I have a controller called Operator. In it I have these two methods:
[HttpGet]
public Response<IEnumerable<OperatorEntity>> GetAllOperators()
{
return GetBL().GetAll();
}
[HttpGet]
public Response<OperatorEntity> GetOperator(Guid id)
{
return GetBL().Get(id);
}
In my WPF app I call this:
Response<List<OperatorEntity>> getAllOpsResponse = await _operatorWebAPIProxy.GetAllOperatorsAsync();
Note that I'm calling GetAllOperatorsAsync
The call fails with the message
The request is invalid.The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Guid' for method 'RemoteServices.Shared.Classes.Response`1[RemoteServices.Shared.Entities.OperatorEntity] GetOperator(System.Guid)' in 'RemoteServices.ServicesWebAPI.Controllers.OperatorController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
The message is saying that it's trying to reach GetOperator, not GetAllOperatorsAsync.
The URL I'm passing is http://localhost:53122/api/Operator/GetAllOperators/
This was working yesterday. This morning, the only change was me removing and re-adding the web API project. I copied the controller classess out, removed the Web API Project, re-added it and the two controllers, and this started.
Anyone know what's going on?
[UPDATE]
I have multiple GET methods in my controller. Fix is here.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 1-Mar-19 14:17pm.
|
|
|
|
|
Sample Web Application with Login Form . On User log in capture the Ip Address , Host Name and store in database.
|
|
|
|